From: Chandler Carruth Date: Mon, 23 Jan 2017 07:03:41 +0000 (+0000) Subject: [PM] Clear any analyses for a dead function after inlining it and before X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b9bbdd037b735457fc698abb2b7c0c0e2db32e89;p=llvm [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292770 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp index dfc1a6ba738..e2dc1158549 100644 --- a/lib/Transforms/IPO/Inliner.cpp +++ b/lib/Transforms/IPO/Inliner.cpp @@ -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!");