[llvm] r292770 - [PM] Clear any analyses for a dead function after inlining it and before

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 22 23:03:42 PST 2017


Author: chandlerc
Date: Mon Jan 23 01:03:41 2017
New Revision: 292770

URL: http://llvm.org/viewvc/llvm-project?rev=292770&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/Transforms/IPO/Inliner.cpp

Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=292770&r1=292769&r2=292770&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Mon Jan 23 01:03:41 2017
@@ -887,10 +887,11 @@ PreservedAnalyses InlinerPass::run(LazyC
         // 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!");




More information about the llvm-commits mailing list