aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/CallGraphUpdater.cpp
diff options
context:
space:
mode:
authorSergey Dmitriev <serguei.n.dmitriev@intel.com>2020-05-04 18:58:59 -0700
committerSergey Dmitriev <serguei.n.dmitriev@intel.com>2020-05-04 18:59:47 -0700
commitf637334df93f231460a12adc35cbf8c5e8cf35c5 (patch)
treee319b12cb47ef08c59127edd95ba4a41e7bc63fd /llvm/lib/Transforms/Utils/CallGraphUpdater.cpp
parentd75a6e93ae99bfcd67219454307da56ebd155d45 (diff)
downloadllvm-f637334df93f231460a12adc35cbf8c5e8cf35c5.zip
llvm-f637334df93f231460a12adc35cbf8c5e8cf35c5.tar.gz
llvm-f637334df93f231460a12adc35cbf8c5e8cf35c5.tar.bz2
[CallGraphUpdater] Removed references to calles when deleting function
Summary: Otherwise we can get unaccounted references to call graph nodes. Reviewers: jdoerfert, sstefan1 Reviewed By: jdoerfert Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D79382
Diffstat (limited to 'llvm/lib/Transforms/Utils/CallGraphUpdater.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/CallGraphUpdater.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/CallGraphUpdater.cpp b/llvm/lib/Transforms/Utils/CallGraphUpdater.cpp
index 8cdf01e..8060e50ab 100644
--- a/llvm/lib/Transforms/Utils/CallGraphUpdater.cpp
+++ b/llvm/lib/Transforms/Utils/CallGraphUpdater.cpp
@@ -112,8 +112,11 @@ void CallGraphUpdater::removeFunction(Function &DeadFn) {
DeadFunctions.push_back(&DeadFn);
// For the old call graph we remove the function from the SCC right away.
- if (CG && !ReplacedFunctions.count(&DeadFn))
- CGSCC->DeleteNode((*CG)[&DeadFn]);
+ if (CG && !ReplacedFunctions.count(&DeadFn)) {
+ CallGraphNode *DeadCGN = (*CG)[&DeadFn];
+ DeadCGN->removeAllCalledFunctions();
+ CGSCC->DeleteNode(DeadCGN);
+ }
}
void CallGraphUpdater::replaceFunctionWith(Function &OldFn, Function &NewFn) {