diff options
author | Johannes Doerfert <johannes@jdoerfert.de> | 2020-03-23 01:09:49 -0500 |
---|---|---|
committer | Johannes Doerfert <johannes@jdoerfert.de> | 2020-04-08 22:52:46 -0500 |
commit | cb0ecc5c33bd56a3eed0fa30ac787accec45d637 (patch) | |
tree | cda8ded6c833cc64d472780db55b12f09a1355c4 /llvm/lib/Transforms/Utils/CallGraphUpdater.cpp | |
parent | 5877d6f5f46cb2a61b6887504508fdb4c60fb157 (diff) | |
download | llvm-cb0ecc5c33bd56a3eed0fa30ac787accec45d637.zip llvm-cb0ecc5c33bd56a3eed0fa30ac787accec45d637.tar.gz llvm-cb0ecc5c33bd56a3eed0fa30ac787accec45d637.tar.bz2 |
[CallGraphUpdater] Remove dead constants before replacing a function
Dead constants might be left when a function is replaced, we can
gracefully handle this case and avoid complexity for the users who would
see an assertion otherwise.
Diffstat (limited to 'llvm/lib/Transforms/Utils/CallGraphUpdater.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/CallGraphUpdater.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/CallGraphUpdater.cpp b/llvm/lib/Transforms/Utils/CallGraphUpdater.cpp index a7a214d..4de7124 100644 --- a/llvm/lib/Transforms/Utils/CallGraphUpdater.cpp +++ b/llvm/lib/Transforms/Utils/CallGraphUpdater.cpp @@ -106,6 +106,7 @@ void CallGraphUpdater::removeFunction(Function &DeadFn) { } void CallGraphUpdater::replaceFunctionWith(Function &OldFn, Function &NewFn) { + OldFn.removeDeadConstantUsers(); ReplacedFunctions.insert(&OldFn); if (CG) { // Update the call graph for the newly promoted function. |