[llvm] 4b1c807 - [NFC][ArgumentPromotion] Clear FAM cached results of erased function.
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 18 09:17:44 PDT 2021
Author: Mircea Trofin
Date: 2021-03-18T09:17:32-07:00
New Revision: 4b1c8070bb8c3d59f746c4daa16f27547cd71b86
URL: https://github.com/llvm/llvm-project/commit/4b1c8070bb8c3d59f746c4daa16f27547cd71b86
DIFF: https://github.com/llvm/llvm-project/commit/4b1c8070bb8c3d59f746c4daa16f27547cd71b86.diff
LOG: [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.
Added:
Modified:
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
index fe5cd7671213..5f24d53da0b3 100644
--- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -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();
}
More information about the llvm-commits
mailing list