llvm.org GIT mirror llvm / 18f0231
Handle single-entry phi nodes gracefully in condprop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62985 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
2 changed file(s) with 45 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
125125 // one use (the branch), and is the only instruction besides the branch in the
126126 // block.
127127 PHINode *PN = cast(BI->getCondition());
128
129 if (PN->getNumIncomingValues() == 1) {
130 // Eliminate single-entry PHI nodes.
131 FoldSingleEntryPHINodes(PN->getParent());
132 return;
133 }
134
135
128136 if (!PN->hasOneUse()) return;
129137
130138 BasicBlock *BB = BI->getParent();
0 ; RUN: llvm-as < %s | opt -condprop | llvm-dis
1 ; PR3405
2 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
3 target triple = "x86_64-unknown-linux-gnu"
4
5 define i32 @main(i32 %argc, i8** %argv) nounwind {
6 entry:
7 br label %bb2
8
9 bb2: ; preds = %bb.bb2_crit_edge, %entry
10 br i1 false, label %bb5.thread2, label %bb
11
12 bb: ; preds = %bb2
13 br i1 false, label %bb3, label %bb.bb2_crit_edge
14
15 bb.bb2_crit_edge: ; preds = %bb
16 br label %bb2
17
18 bb3: ; preds = %bb
19 %.lcssa4 = phi i1 [ false, %bb ] ; [#uses=1]
20 br i1 %.lcssa4, label %bb5.thread, label %bb6
21
22 bb5.thread: ; preds = %bb3
23 br label %bb7
24
25 bb7: ; preds = %bb5.thread2, %bb5.thread
26 br label %UnifiedReturnBlock
27
28 bb6: ; preds = %bb3
29 br label %UnifiedReturnBlock
30
31 bb5.thread2: ; preds = %bb2
32 br label %bb7
33
34 UnifiedReturnBlock: ; preds = %bb6, %bb7
35 ret i32 0
36 }