[llvm-bugs] [Bug 25031] New: PowerPC code generation bug: relative branch cannot be resolved by linker

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 2 12:21:40 PDT 2015


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: unassignedbugs at nondot.org
          Reporter: eric.schweitz at pgroup.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151002/2cb7307c/attachment.html>


More information about the llvm-bugs mailing list