summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorJohannes Doerfert <jdoerfert@anl.gov>2019-09-04 20:34:52 +0000
committerJohannes Doerfert <jdoerfert@anl.gov>2019-09-04 20:34:52 +0000
commit7ab525370435ec501260e6083fc2debe7218e9c2 (patch)
tree91eccf31c22916a62d588857bb00a75304c479f7 /llvm/lib/Transforms
parentd581dd50138186fe2c29eff617e7ca5897e3c69e (diff)
downloadbcm5719-llvm-7ab525370435ec501260e6083fc2debe7218e9c2.tar.gz
bcm5719-llvm-7ab525370435ec501260e6083fc2debe7218e9c2.zip
[Attributor][Fix] Make sure we do not delete live code
Summary: Liveness needs to mark edges, not blocks as dead. Reviewers: sstefan1, uenoku Subscribers: hiraditya, bollu, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67191 llvm-svn: 370975
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/Attributor.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 04b9c5f8ced..672968f8302 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -1883,8 +1883,20 @@ struct AAIsDeadImpl : public AAIsDead {
}
}
- if (SplitPos == &NormalDestBB->front())
- assumeLive(A, *NormalDestBB);
+ if (SplitPos == &NormalDestBB->front()) {
+ // If this is an invoke of a noreturn function the edge to the normal
+ // destination block is dead but not necessarily the block itself.
+ // TODO: We need to move to an edge based system during deduction and
+ // also manifest.
+ assert(!NormalDestBB->isLandingPad() &&
+ "Expected the normal destination not to be a landingpad!");
+ BasicBlock *SplitBB =
+ SplitBlockPredecessors(NormalDestBB, {BB}, ".dead");
+ // The split block is live even if it contains only an unreachable
+ // instruction at the end.
+ assumeLive(A, *SplitBB);
+ SplitPos = SplitBB->getTerminator();
+ }
}
BB = SplitPos->getParent();
OpenPOWER on IntegriCloud