[llvm] 789f012 - [CodeGenPrepare] Implement releaseMemory
Sven van Haastregt via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 28 03:33:55 PDT 2023
Author: Sven van Haastregt
Date: 2023-06-28T11:33:27+01:00
New Revision: 789f012d505b0d570bc74bca92e43f931c1309ca
URL: https://github.com/llvm/llvm-project/commit/789f012d505b0d570bc74bca92e43f931c1309ca
DIFF: https://github.com/llvm/llvm-project/commit/789f012d505b0d570bc74bca92e43f931c1309ca.diff
LOG: [CodeGenPrepare] Implement releaseMemory
Release BlockFrequencyInfo and BranchProbabilityInfo results and other
per function information immediately afterwards, instead of holding
onto the memory until the next `CodeGenPrepare::runOnFunction` call.
Differential Revision: https://reviews.llvm.org/D152552
Co-authored-by: Erik Hogeman <erik.hogeman at arm.com>
Added:
Modified:
llvm/lib/CodeGen/CodeGenPrepare.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index fba31c65602b4..45e6eea05fdb4 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -377,6 +377,15 @@ class CodeGenPrepare : public FunctionPass {
bool runOnFunction(Function &F) override;
+ void releaseMemory() override {
+ // Clear per function information.
+ InsertedInsts.clear();
+ PromotedInsts.clear();
+ FreshBBs.clear();
+ BPI.reset();
+ BFI.reset();
+ }
+
StringRef getPassName() const override { return "CodeGen Prepare"; }
void getAnalysisUsage(AnalysisUsage &AU) const override {
@@ -498,10 +507,6 @@ bool CodeGenPrepare::runOnFunction(Function &F) {
DL = &F.getParent()->getDataLayout();
bool EverMadeChange = false;
- // Clear per function information.
- InsertedInsts.clear();
- PromotedInsts.clear();
- FreshBBs.clear();
TM = &getAnalysis<TargetPassConfig>().getTM<TargetMachine>();
SubtargetInfo = TM->getSubtargetImpl(F);
More information about the llvm-commits
mailing list