[PATCH] D30916: LowerSwitch: Fix producing invalid IR on unreachable code

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 21 16:44:06 PDT 2017


hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm

It's been a long time since I did anything with LowerSwitch, but this seems like a straight-forward fix.



================
Comment at: lib/Transforms/Utils/LowerSwitch.cpp:406
 
+  if ((CurBlock != &F->getEntryBlock() && pred_empty(CurBlock)) ||
+      CurBlock->getSinglePredecessor() == CurBlock) {
----------------
I'd suggest a comment here.


================
Comment at: test/Transforms/LowerSwitch/phi-in-dead-block.ll:4
+; CHECK-LABEL: @phi_in_dead_block(
+; CHECK-NOT: switch
+define void @phi_in_dead_block() {
----------------
Did we really get left with a switch before?


https://reviews.llvm.org/D30916





More information about the llvm-commits mailing list