[PATCH] D13718: [SimplifyCFG] Extend SimplifyResume to handle phi of trivial landing pad.

Chen Li via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 21 21:45:03 PDT 2015


chenli added inline comments.

================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:2971
@@ +2970,3 @@
+  // Delete the resume block if all its predecessors have been deleted.
+  if (BB->getParent() && pred_begin(BB) == pred_end(BB)) {
+    BB->eraseFromParent();
----------------
reames wrote:
> BB->getParent should always be set?  Is this defensive programming (remove it), or a bug (add test case)?
We could have already erased BB if it is in TrivialUnwindBlocks. In that case BB becomes a dangling pointer. My code here isn't actually safe though. I should reset BB to nullptr on line 2967 if TrivialBB equals to BB. I will change it.


http://reviews.llvm.org/D13718





More information about the llvm-commits mailing list