<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Bad machine code: PHI operand is not live-out from predecessor"
href="https://bugs.llvm.org/show_bug.cgi?id=45557">45557</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Bad machine code: PHI operand is not live-out from predecessor
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>10.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>FreeBSD
</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>Backend: PowerPC
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>pkubaj@anongoth.pl
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, nemanja.i.ibm@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>FreeBSD head, LLVM 10.0.0, powerpc architecture (32-bit)
Reduced test case:
a, b;
c() {
int d;
int e[] = {0, &a};
if (b)
e[0] = f();
d = 0;
for (; d < 2; d++)
if (e[d])
g();
}
Compile with:
/usr/bin/cc -cc1 -triple powerpc-unknown-freebsd13.0 -emit-obj -O2
-mrelocation-model static -x c pbx_variables-3bff13.c
Problem:
# Machine code for function c: IsSSA, TracksLiveness
bb.0.entry:
successors: %bb.2(0x30000000), %bb.1(0x50000000); %bb.2(37.50%),
%bb.1(62.50%)
%4:gprc_and_gprc_nor0 = LIS target-flags(ppc-ha) @__const.c.e
%6:gprc_and_gprc_nor0 = LIS target-flags(ppc-ha) @b
%7:gprc = LWZ target-flags(ppc-lo) @b, killed %6:gprc_and_gprc_nor0 ::
(dereferenceable load 4 from @b, !tbaa !2)
%8:crrc = CMPLWI killed %7:gprc, 0
BCC 76, killed %8:crrc, %bb.2
B %bb.1
bb.1.if.then:
; predecessors: %bb.0
successors: %bb.2(0x80000000); %bb.2(100.00%)
ADJCALLSTACKDOWN 8, 0, implicit-def dead $r1, implicit $r1
BL @f, <regmask $cr2 $cr3 $cr4 $f14 $f15 $f16 $f17 $f18 $f19 $f20 $f21 $f22
$f23 $f24 $f25 $f26 $f27 $f28 $f29 $f30 $f31 $r14 $r15 $r16 $r17 $r18 $r19 $r20
$r21 $r22 $r23 $r24 $r25 and 18 more...>, implicit-def dead $lr, implicit $rm,
implicit-def $r1, implicit-def $r3
ADJCALLSTACKUP 8, 0, implicit-def dead $r1, implicit $r1
%9:gprc = COPY $r3
%2:gprc = COPY %9:gprc
bb.2.if.end:
; predecessors: %bb.0, %bb.1
successors: %bb.4(0x30000000), %bb.3(0x50000000); %bb.4(37.50%),
%bb.3(62.50%)
%3:gprc = PHI %0:gprc, %bb.0, %2:gprc, %bb.1
%0:gprc, %5:gprc_and_gprc_nor0 = LWZU target-flags(ppc-lo) @__const.c.e,
%4:gprc_and_gprc_nor0(tied-def 1) :: (load 4 from `i64* bitcast ([2 x i32]*
@__const.c.e to i64*)`, align 8)
%1:gprc = LWZ 4, %5:gprc_and_gprc_nor0 :: (dereferenceable load 4 from `i64*
bitcast ([2 x i32]* @__const.c.e to i64*)` + 4)
%10:crrc = CMPLWI %3:gprc, 0
BCC 76, killed %10:crrc, %bb.4
B %bb.3
bb.3.if.then3:
; predecessors: %bb.2
successors: %bb.4(0x80000000); %bb.4(100.00%)
ADJCALLSTACKDOWN 8, 0, implicit-def dead $r1, implicit $r1
BL @g, <regmask $cr2 $cr3 $cr4 $f14 $f15 $f16 $f17 $f18 $f19 $f20 $f21 $f22
$f23 $f24 $f25 $f26 $f27 $f28 $f29 $f30 $f31 $r14 $r15 $r16 $r17 $r18 $r19 $r20
$r21 $r22 $r23 $r24 $r25 and 18 more...>, implicit-def dead $lr, implicit $rm,
implicit-def $r1, implicit-def $r3
ADJCALLSTACKUP 8, 0, implicit-def dead $r1, implicit $r1
bb.4.for.inc:
; predecessors: %bb.2, %bb.3
successors: %bb.6(0x30000000), %bb.5(0x50000000); %bb.6(37.50%),
%bb.5(62.50%)
%12:crrc = CMPLWI %1:gprc, 0
BCC 76, killed %12:crrc, %bb.6
B %bb.5
bb.5.if.then3.1:
; predecessors: %bb.4
successors: %bb.6(0x80000000); %bb.6(100.00%)
ADJCALLSTACKDOWN 8, 0, implicit-def dead $r1, implicit $r1
BL @g, <regmask $cr2 $cr3 $cr4 $f14 $f15 $f16 $f17 $f18 $f19 $f20 $f21 $f22
$f23 $f24 $f25 $f26 $f27 $f28 $f29 $f30 $f31 $r14 $r15 $r16 $r17 $r18 $r19 $r20
$r21 $r22 $r23 $r24 $r25 and 18 more...>, implicit-def dead $lr, implicit $rm,
implicit-def $r1, implicit-def $r3
ADJCALLSTACKUP 8, 0, implicit-def dead $r1, implicit $r1
bb.6.for.inc.1:
; predecessors: %bb.4, %bb.5
%14:gprc = IMPLICIT_DEF
$r3 = COPY %14:gprc
BLR implicit $lr, implicit $rm, implicit $r3
# End machine code for function c.
*** Bad machine code: PHI operand is not live-out from predecessor ***
- function: c
- basic block: %bb.2 if.end (0x8168a95e0)
- instruction: %3:gprc = PHI %0:gprc, %bb.0, %2:gprc, %bb.1
- operand 1: %0:gprc
fatal error: error in backend: Found 1 machine code errors.</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>