llvm.org GIT mirror llvm / 3b739d2
Tolerate degenerate phi nodes that can occur in the middle of optimization passes. Fixes PR9112. Patch by Jakub Staszak! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125319 91177308-0d34-0410-b5e6-96231b3b80d8 Nick Lewycky 8 years ago
2 changed file(s) with 28 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
588588 }
589589 }
590590 }
591
592 // Unreachable blocks may have zero-operand PHI nodes.
593 if (P->getNumIncomingValues() == 0)
594 return;
591595
592596 // Otherwise take the unions of the known bit sets of the operands,
593597 // taking conservative care to avoid excessive recursion.
0 ; RUN: opt -jump-threading -disable-output %s
1 ; PR9112
2
3 ; This is actually a test for value tracking. Jump threading produces
4 ; "%phi = phi i16" when it removes all edges leading to %unreachable.
5 ; The .ll parser won't let us write that directly since it's invalid code.
6
7 define void @func() nounwind {
8 entry:
9 br label %bb
10
11 bb:
12 br label %bb
13
14 unreachable:
15 %phi = phi i16 [ %add, %unreachable ], [ 0, %next ]
16 %add = add i16 0, %phi
17 %cmp = icmp slt i16 %phi, 0
18 br i1 %cmp, label %unreachable, label %next
19
20 next:
21 br label %unreachable
22 }
23