<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - PowerPC code generation bug: relative branch cannot be resolved by linker"
href="https://llvm.org/bugs/show_bug.cgi?id=25031">25031</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>PowerPC code generation bug: relative branch cannot be resolved by linker
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>eric.schweitz@pgroup.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=14988" name="attach_14988" title="a potential patch">attachment 14988</a> <a href="attachment.cgi?id=14988&action=edit" title="a potential patch">[details]</a></span>
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>