<p dir="ltr"><br>
On Jul 8, 2014 5:56 AM, "Pete" <<a href="mailto:peter_cooper@apple.com">peter_cooper@apple.com</a>> wrote:<br>
><br>
> ================<br>
> Comment at: lib/Transforms/Utils/LowerSwitch.cpp:137<br>
> @@ +136,3 @@<br>
> +                    BasicBlock *NewNode) {<br>
> + for (BasicBlock::iterator I = Succ->begin(), E = Succ->getFirstNonPHI();<br>
> +      I != E; ++I) {<br>
> ----------------<br>
> 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.</p>
<p dir="ltr">That doesn't sound right. The IR spec says this about phis:</p>
<p dir="ltr">" There must be no non-phi instructions between the start of a basic block and the PHI instructions: i.e. PHI instructions must be first in a basic block."</p>
<p dir="ltr">> I think you'll need getFirstNonPHIOrDbgOrLifetime(),</p>
<p dir="ltr">I believe the dbg and lifetime intrinsics still have to come after the phi's. This aggressor is useful when iterating the 'real' instructions so the dbg and lifetime intrinsics can be skipped, I don't think it's relevant/necessary when looking for phis.</p>

<p dir="ltr">> and then to have the loop skip anything which isn't a phi.<br>
><br>
> <a href="http://reviews.llvm.org/D4298">http://reviews.llvm.org/D4298</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</p>