aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorSven van Haastregt <sven.vanhaastregt@arm.com>2023-06-28 11:33:27 +0100
committerSven van Haastregt <sven.vanhaastregt@arm.com>2023-06-28 11:33:27 +0100
commit789f012d505b0d570bc74bca92e43f931c1309ca (patch)
treeefcd5fce061c98cd5b06b355d88fe4905c92fd35 /llvm/lib/CodeGen/CodeGenPrepare.cpp
parent98d6ab9d6a4918e3887334672716278a1b632c12 (diff)
downloadllvm-789f012d505b0d570bc74bca92e43f931c1309ca.zip
llvm-789f012d505b0d570bc74bca92e43f931c1309ca.tar.gz
llvm-789f012d505b0d570bc74bca92e43f931c1309ca.tar.bz2
[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@arm.com>
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index fba31c6..45e6eea 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -377,6 +377,15 @@ public:
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);