[llvm] 3648dde - [ARM][MachineOutliner] Fix memory leak #2.
Yvan Roux via llvm-commits
llvm-commits at lists.llvm.org
Fri May 15 08:40:19 PDT 2020
Author: Yvan Roux
Date: 2020-05-15T17:33:56+02:00
New Revision: 3648dde3ddd3cc0ba862017d494b7ede6054631c
URL: https://github.com/llvm/llvm-project/commit/3648dde3ddd3cc0ba862017d494b7ede6054631c
DIFF: https://github.com/llvm/llvm-project/commit/3648dde3ddd3cc0ba862017d494b7ede6054631c.diff
LOG: [ARM][MachineOutliner] Fix memory leak #2.
Use smart pointer instead of new/delete.
Added:
Modified:
llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
index 20df55f55bc8..471a062e8158 100644
--- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
@@ -5649,7 +5649,7 @@ outliner::OutlinedFunction ARMBaseInstrInfo::getOutliningCandidateInfo(
C.setCallInfo(CallID, NumBytesForCall);
};
- OutlinerCosts *Costs = new OutlinerCosts(Subtarget);
+ auto Costs = std::make_unique<OutlinerCosts>(Subtarget);
unsigned FrameID = 0;
unsigned NumBytesToCreateFrame = 0;
@@ -5668,7 +5668,6 @@ outliner::OutlinedFunction ARMBaseInstrInfo::getOutliningCandidateInfo(
} else
return outliner::OutlinedFunction();
- delete Costs;
return outliner::OutlinedFunction(RepeatedSequenceLocs, SequenceSize,
NumBytesToCreateFrame, FrameID);
}
More information about the llvm-commits
mailing list