[PATCH] D36879: [ADCE] Don't mark block with UnreachableInst as live
Jakub Kuderski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 18 09:53:39 PDT 2017
kuhar created this revision.
Herald added a subscriber: david2050.
Herald added a reviewer: grosser.
Both ReturnInst and UnreachableInst exit functions, so we can treat them the same in ADCE and not mark them as live.
The only the CFG nodes corresponding to non-trivial PostDominatorTree roots (i.e. infinite loop blocks) need to be marked as live here for ADCE to work correctly.
https://reviews.llvm.org/D36879
Files:
lib/Transforms/Scalar/ADCE.cpp
Index: lib/Transforms/Scalar/ADCE.cpp
===================================================================
--- lib/Transforms/Scalar/ADCE.cpp
+++ lib/Transforms/Scalar/ADCE.cpp
@@ -267,9 +267,10 @@
auto *BB = PDTChild->getBlock();
auto &Info = BlockInfo[BB];
// Real function return
- if (isa<ReturnInst>(Info.Terminator)) {
- DEBUG(dbgs() << "post-dom root child is a return: " << BB->getName()
- << '\n';);
+ if (isa<ReturnInst>(Info.Terminator) ||
+ isa<UnreachableInst>(Info.Terminator)) {
+ DEBUG(dbgs() << "post-dom root child is a return or unreachable: "
+ << BB->getName() << '\n';);
continue;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36879.111692.patch
Type: text/x-patch
Size: 692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170818/0fe3c5d9/attachment.bin>
More information about the llvm-commits
mailing list