[PATCH] Fixup PHI nodes in LowerSwitch

Pete peter_cooper at apple.com
Tue Jul 8 05:51:09 PDT 2014


================
Comment at: lib/Transforms/Utils/LowerSwitch.cpp:137
@@ +136,3 @@
+                    BasicBlock *NewNode) {
+ for (BasicBlock::iterator I = Succ->begin(), E = Succ->getFirstNonPHI();
+      I != E; ++I) {
----------------
I don't think this will work when debugging is enabled as phi's aren't always the first instructions in a BB, or even contiguous.

I think you'll need getFirstNonPHIOrDbgOrLifetime(), and then to have the loop skip anything which isn't a phi.

http://reviews.llvm.org/D4298






More information about the llvm-commits mailing list