[llvm] r304064 - [PartialInlining] Replace delete with unique_ptr in computeCallsiteToProfCountMap
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri May 26 22:32:09 PDT 2017
Author: vitalybuka
Date: Sat May 27 00:32:09 2017
New Revision: 304064
URL: http://llvm.org/viewvc/llvm-project?rev=304064&view=rev
Log:
[PartialInlining] Replace delete with unique_ptr in computeCallsiteToProfCountMap
Reviewers: davidxl
Reviewed By: davidxl
Subscribers: vsk, llvm-commits
Differential Revision: https://reviews.llvm.org/D33220
Modified:
llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp
Modified: llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp?rev=304064&r1=304063&r2=304064&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp Sat May 27 00:32:09 2017
@@ -558,17 +558,17 @@ void PartialInlinerImpl::computeCallsite
std::vector<User *> Users(DuplicateFunction->user_begin(),
DuplicateFunction->user_end());
Function *CurrentCaller = nullptr;
+ std::unique_ptr<BlockFrequencyInfo> TempBFI;
BlockFrequencyInfo *CurrentCallerBFI = nullptr;
auto ComputeCurrBFI = [&,this](Function *Caller) {
// For the old pass manager:
if (!GetBFI) {
- if (CurrentCallerBFI)
- delete CurrentCallerBFI;
DominatorTree DT(*Caller);
LoopInfo LI(DT);
BranchProbabilityInfo BPI(*Caller, LI);
- CurrentCallerBFI = new BlockFrequencyInfo(*Caller, BPI, LI);
+ TempBFI.reset(new BlockFrequencyInfo(*Caller, BPI, LI));
+ CurrentCallerBFI = TempBFI.get();
} else {
// New pass manager:
CurrentCallerBFI = &(*GetBFI)(*Caller);
@@ -591,10 +591,6 @@ void PartialInlinerImpl::computeCallsite
else
CallSiteToProfCountMap[User] = 0;
}
- if (!GetBFI) {
- if (CurrentCallerBFI)
- delete CurrentCallerBFI;
- }
}
Function *PartialInlinerImpl::unswitchFunction(Function *F) {
More information about the llvm-commits
mailing list