[PATCH] Fixup PHI nodes in LowerSwitch

Philip Reames listmail at philipreames.com
Wed Jul 2 11:29:40 PDT 2014


I think I convinced myself this is correct code wise.  The test diffs needs cleaned up.

================
Comment at: lib/Transforms/Utils/LowerSwitch.cpp:137
@@ +136,3 @@
+                    BasicBlock *NewNode) {
+ for (BasicBlock::iterator I = Succ->begin(); isa<PHINode>(I); ++I) {
+   PHINode* PN = cast<PHINode>(I);
----------------
You could use firstNonPHI as the end iterator here rather than is isa<PHINode> check if desired.  Either is functionally correct.

================
Comment at: test/Transforms/LowerSwitch/feature.ll:26
@@ -28,4 +25,3 @@
 
-;CHECK:     NodeBlock9:                                       ; preds = %NodeBlock17
-;CHECK-NEXT:  %Pivot10 = icmp slt i32 %tmp158, 11
-;CHECK-NEXT:  br i1 %Pivot10, label %bb324, label %NodeBlock7
+;CHECK: NodeBlock10:                                      ; preds = %NodeBlock18
+;CHECK-NEXT:  %Pivot9 = icmp slt i32 %tmp158, 11
----------------
Figuring out what actually change in this test is really hard.  Please separate the whitespace changes into another change set.

http://reviews.llvm.org/D4298






More information about the llvm-commits mailing list