[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>
This commit is contained in:
parent
98d6ab9d6a
commit
789f012d50
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user