[NFC][ArgumentPromotion] Clear FAM cached results of erased function.

Not doing it here can lead to subtle bugs - the analysis results are
associated by the Function object's address. Nothing stops the memory
allocator from allocating new functions at the same address.
This commit is contained in:
Mircea Trofin committed 2021-03-18 09:17:32 -07:00
1 parent c2f8e158f5
commit 4b1c8070bb
1 file changed
+1
@@ -1052,6 +1052,7 @@ PreservedAnalyses ArgumentPromotionPass::run(LazyCallGraph::SCC &C,
// swaps out the particular function mapped to a particular node in the
// graph.
C.getOuterRefSCC().replaceNodeFunction(N, *NewF);
FAM.clear(OldF, OldF.getName());
OldF.eraseFromParent();
}