summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2017-03-16 10:45:42 +0000
committerChandler Carruth <chandlerc@gmail.com>2017-03-16 10:45:42 +0000
commit814e0df1c53c9f98eba7315656e11b6311b486e3 (patch)
tree01dc6555ea227cddbb7cadd05ebcd1aa49cfeb58 /llvm/lib/Transforms
parent7b8270424e8f12d7825ffc9ff2d892c004dcb26b (diff)
downloadbcm5719-llvm-814e0df1c53c9f98eba7315656e11b6311b486e3.tar.gz
bcm5719-llvm-814e0df1c53c9f98eba7315656e11b6311b486e3.zip
[PM/Inliner] Fix a bug in r297374 where we would leave stale calls in
the work queue and crash when trying to visit them after deleting the function containing those calls. llvm-svn: 297940
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/Inliner.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp
index 5ea26a86eb8..31589ac99ee 100644
--- a/llvm/lib/Transforms/IPO/Inliner.cpp
+++ b/llvm/lib/Transforms/IPO/Inliner.cpp
@@ -903,6 +903,12 @@ PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC,
// made dead by this operation on other functions).
Callee.removeDeadConstantUsers();
if (Callee.use_empty()) {
+ Calls.erase(
+ std::remove_if(Calls.begin() + i + 1, Calls.end(),
+ [&Callee](const std::pair<CallSite, int> &Call) {
+ return Call.first.getCaller() == &Callee;
+ }),
+ Calls.end());
// Clear the body and queue the function itself for deletion when we
// finish inlining and call graph updates.
// Note that after this point, it is an error to do anything other
OpenPOWER on IntegriCloud