[PATCH] D11852: [LowerSwitch] Fix a bug when LowerSwitch deletes the default block

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 11:11:14 PDT 2015


hans added inline comments.

================
Comment at: lib/Transforms/Utils/LowerSwitch.cpp:528
@@ -522,3 +527,3 @@
   if (pred_begin(OldDefault) == pred_end(OldDefault))
-    DeleteDeadBlock(OldDefault);
+    DeleteList.push_back(OldDefault);
 }
----------------
I don't think maintaining a DeleteList is very nice, and as you say it has the problem that we might call processSwitchInst on a block even if it's dead.

How about we remove the DeleteDeadBlock call here, and in the loop in runOnFunction(), we add something like:


```
if (block has no predecessors) {
  delete it
  continue
}
```


http://reviews.llvm.org/D11852





More information about the llvm-commits mailing list