]> granicus.if.org Git - llvm/commitdiff
[PM] Clear any analyses for a dead function after inlining it and before
authorChandler Carruth <chandlerc@gmail.com>
Mon, 23 Jan 2017 07:03:41 +0000 (07:03 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 23 Jan 2017 07:03:41 +0000 (07:03 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292770 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/Inliner.cpp

index dfc1a6ba7385ec1444f769259353e7731aa71db2..e2dc1158549b3195b7d288e8197061a42e4b65b2 100644 (file)
@@ -887,10 +887,11 @@ PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC,
         // 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!");