[PATCH] D50717: [SimplifyCFG] Fix BasicBlock use-after-free
Chijun Sima via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 14 09:23:03 PDT 2018
NutshellySima created this revision.
NutshellySima added reviewers: kuhar, dmgreen, davide, trentxintong.
Herald added a subscriber: llvm-commits.
Fix use-after-free in SimplifyCFG pass.
Repository:
rL LLVM
https://reviews.llvm.org/D50717
Files:
lib/Transforms/Utils/SimplifyCFG.cpp
Index: lib/Transforms/Utils/SimplifyCFG.cpp
===================================================================
--- lib/Transforms/Utils/SimplifyCFG.cpp
+++ lib/Transforms/Utils/SimplifyCFG.cpp
@@ -3861,9 +3861,9 @@
}
// The landingpad is now unreachable. Zap it.
- BB->eraseFromParent();
if (LoopHeaders)
LoopHeaders->erase(BB);
+ BB->eraseFromParent();
return true;
}
@@ -4083,9 +4083,9 @@
// If we eliminated all predecessors of the block, delete the block now.
if (pred_empty(BB)) {
// We know there are no successors, so just nuke the block.
- BB->eraseFromParent();
if (LoopHeaders)
LoopHeaders->erase(BB);
+ BB->eraseFromParent();
}
return true;
@@ -4245,9 +4245,9 @@
// If this block is now dead, remove it.
if (pred_empty(BB) && BB != &BB->getParent()->getEntryBlock()) {
// We know there are no successors, so just nuke the block.
- BB->eraseFromParent();
if (LoopHeaders)
LoopHeaders->erase(BB);
+ BB->eraseFromParent();
return true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50717.160609.patch
Type: text/x-patch
Size: 1066 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180814/baff8278/attachment.bin>
More information about the llvm-commits
mailing list