summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorFlorian Hahn <florian.hahn@arm.com>2018-09-07 11:41:34 +0000
committerFlorian Hahn <florian.hahn@arm.com>2018-09-07 11:41:34 +0000
commitb30f7aeeeb2ead53ce8f52abd98dcd61916863ba (patch)
tree8ceda9fc20a789fb8929820dc995b639d3669759 /llvm/lib/Transforms
parenta2aef22a7283156d00d218c1da90ba197906f734 (diff)
downloadbcm5719-llvm-b30f7aeeeb2ead53ce8f52abd98dcd61916863ba.tar.gz
bcm5719-llvm-b30f7aeeeb2ead53ce8f52abd98dcd61916863ba.zip
[NewGVN] Mark function as changed if we erase instructions.
Currently eliminateInstructions only returns true if any instruction got replaced. In the test case for this patch, we eliminate the trivially dead calls, for which eliminateInstructions not do a replacement and the function is not marked as changed, which is why the inliner crashes while traversing the call graph. Alternatively we could also change eliminateInstructions to return true in case we mark instructions for deletion, but that's slightly more code and doing it at the place where the replacement happens seems safer. Fixes PR37517. Reviewers: davide, mcrosier, efriedma, bjope Reviewed By: bjope Differential Revision: https://reviews.llvm.org/D51169 llvm-svn: 341651
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/NewGVN.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp
index 54fe5fd79d7..f3cbd87cae6 100644
--- a/llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -3497,9 +3497,11 @@ bool NewGVN::runGVN() {
if (!ToErase->use_empty())
ToErase->replaceAllUsesWith(UndefValue::get(ToErase->getType()));
- if (ToErase->getParent())
- ToErase->eraseFromParent();
+ assert(ToErase->getParent() &&
+ "BB containing ToErase deleted unexpectedly!");
+ ToErase->eraseFromParent();
}
+ Changed |= !InstructionsToErase.empty();
// Delete all unreachable blocks.
auto UnreachableBlockPred = [&](const BasicBlock &BB) {
OpenPOWER on IntegriCloud