[PM] Clear any analyses for a dead function after inlining it and before
clearing its body. This is essential to avoid triggering asserting value
handles in analyses on the function's body.
I'm working on a test case for this behavior in LLVM, but Clang has
a great one that managed to trigger this on all of the bots already.
llvm-svn: 292770
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp
index dfc1a6b..e2dc115 100644
--- a/llvm/lib/Transforms/IPO/Inliner.cpp
+++ b/llvm/lib/Transforms/IPO/Inliner.cpp
@@ -887,10 +887,11 @@
// made dead by this operation on other functions).
Callee.removeDeadConstantUsers();
if (Callee.use_empty()) {
- // Clear the body and queue the function itself for deletion when we
- // finish inlining and call graph updates.
+ // Clear all analyses and 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
// than use the callee's address or delete it.
+ FAM.clear(Callee);
Callee.dropAllReferences();
assert(find(DeadFunctions, &Callee) == DeadFunctions.end() &&
"Cannot put cause a function to become dead twice!");