diff options
author | Vitaly Buka <vitalybuka@google.com> | 2017-05-27 05:32:09 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2017-05-27 05:32:09 +0000 |
commit | a637489ef1f6e66b4d25ec8890a97c51d26e197e (patch) | |
tree | 9db2f46a1789d19b7d2725bc1b24a3e072765f70 /llvm/lib | |
parent | e5d29118564d48c935e929394c256faf3e9a7784 (diff) | |
download | bcm5719-llvm-a637489ef1f6e66b4d25ec8890a97c51d26e197e.tar.gz bcm5719-llvm-a637489ef1f6e66b4d25ec8890a97c51d26e197e.zip |
[PartialInlining] Replace delete with unique_ptr in computeCallsiteToProfCountMap
Reviewers: davidxl
Reviewed By: davidxl
Subscribers: vsk, llvm-commits
Differential Revision: https://reviews.llvm.org/D33220
llvm-svn: 304064
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/IPO/PartialInlining.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/IPO/PartialInlining.cpp b/llvm/lib/Transforms/IPO/PartialInlining.cpp index 8dff2fb3be8..4c417f1c55e 100644 --- a/llvm/lib/Transforms/IPO/PartialInlining.cpp +++ b/llvm/lib/Transforms/IPO/PartialInlining.cpp @@ -558,17 +558,17 @@ void PartialInlinerImpl::computeCallsiteToProfCountMap( 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::computeCallsiteToProfCountMap( else CallSiteToProfCountMap[User] = 0; } - if (!GetBFI) { - if (CurrentCallerBFI) - delete CurrentCallerBFI; - } } Function *PartialInlinerImpl::unswitchFunction(Function *F) { |