[PATCH] Fixup PHI nodes in LowerSwitch

Marcello Maggioni hayarms at gmail.com
Tue Jul 8 06:16:51 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) {
Pete wrote:
> 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.
Thank you pete, I didn't know this :)

I'm fixing this in a new revision.


More information about the llvm-commits mailing list