From: Vitaly Buka Date: Sat, 27 May 2017 05:32:09 +0000 (+0000) Subject: [PartialInlining] Replace delete with unique_ptr in computeCallsiteToProfCountMap X-Git-Tag: android-x86-7.1-r4~15730 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=78cdf9846cc6156a53bc6140ba984b07a5a11ab5;p=android-x86%2Fexternal-llvm.git [PartialInlining] Replace delete with unique_ptr in computeCallsiteToProfCountMap Reviewers: davidxl Reviewed By: davidxl Subscribers: vsk, llvm-commits Differential Revision: https://reviews.llvm.org/D33220 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304064 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/IPO/PartialInlining.cpp b/lib/Transforms/IPO/PartialInlining.cpp index 8dff2fb3be8..4c417f1c55e 100644 --- a/lib/Transforms/IPO/PartialInlining.cpp +++ b/lib/Transforms/IPO/PartialInlining.cpp @@ -558,17 +558,17 @@ void PartialInlinerImpl::computeCallsiteToProfCountMap( std::vector Users(DuplicateFunction->user_begin(), DuplicateFunction->user_end()); Function *CurrentCaller = nullptr; + std::unique_ptr 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::computeCallsiteToProfCountMap( else CallSiteToProfCountMap[User] = 0; } - if (!GetBFI) { - if (CurrentCallerBFI) - delete CurrentCallerBFI; - } } Function *PartialInlinerImpl::unswitchFunction(Function *F) {