https://llvm.org/bugs/show_bug.cgi?id=25031

            Bug ID: 25031
           Summary: PowerPC code generation bug: relative branch cannot be
                    resolved by linker
           Product: new-bugs
           Version: 3.7
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: eric.schwe...@pgroup.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

Created attachment 14988
  --> https://llvm.org/bugs/attachment.cgi?id=14988&action=edit
a potential patch

There is an issue in the algorithm in PPCBranchSelector.cpp. The algorithm
pre-computes the size of each basic block in a function including any
additional padding needed between adjacent blocks due to alignment directives.
Unfortunately, this is a dynamic programming problem as the adjustment of
branches can alter the padding needed as the instruction stream is rewritten.

A small example:

MBB1: (say this is 16 byte aligned)
  instr1
  instr2
  bcc ..., another_galaxy

MBB2:
  bcc ..., another_solar_system

  .align 4
MBB3: (alignment is specified 16 bytes)

Here we would precompute that MBB2 gets 0 bytes of padding. However, this must
be recomputed as after expanding the two distant branches, the .align 4 will
cause 8 bytes of padding, throwing off the precomputed size of MBB2 and any
branches that compute the distance using the size of MBB2. This can cause a
label to drift too far away.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to