Skip to content
  • Bob Wilson's avatar
    Fix another problem with ARM constant pools. Radar 7303551. · b4f2a85f
    Bob Wilson authored
    When ARMConstantIslandPass cannot find any good locations (i.e., "water") to
    place constants, it falls back to inserting unconditional branches to make a
    place to put them.  My recent change exposed a problem in this area.  We may
    sometimes append to the same block more than one unconditional branch.  The
    symptoms of this are that the generated assembly has a branch to an undefined
    label and running llc with -debug will cause a seg fault.
    
    This happens more easily since my change to prevent CPEs from moving from
    lower to higher addresses as the algorithm iterates, but it could have
    happened before.  The end of the block may be in range for various constant
    pool references, but the insertion point for new CPEs is not right at the end
    of the block -- it is at the end of the CPEs that have already been placed
    at the end of the block.  The insertion point could be out of range.  When
    that happens, the fallback code will always append another unconditional
    branch if the end of the block is in range.
    
    The fix is to only append an unconditional branch if the block does not
    already end with one.  I also removed a check to see if the constant pool load
    instruction is at the end of the block, since that is redundant with
    checking if the end of the block is in-range.
    
    There is more to be done here, but I think this fixes the immediate problem.
    
    llvm-svn: 84172
    b4f2a85f
Loading