[llvm] ba3cbc7 - fix a use-after-free failure

via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 28 15:56:31 PDT 2023


Author: wlei
Date: 2023-04-28T15:55:51-07:00
New Revision: ba3cbc7aadf9d47d3eb177934b9e7b8e852a9857

URL: https://github.com/llvm/llvm-project/commit/ba3cbc7aadf9d47d3eb177934b9e7b8e852a9857
DIFF: https://github.com/llvm/llvm-project/commit/ba3cbc7aadf9d47d3eb177934b9e7b8e852a9857.diff

LOG: fix a use-after-free failure

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/SampleProfile.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 634eb459d14c..25ebff8ac168 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -2229,7 +2229,7 @@ void SampleProfileMatcher::runStaleProfileMatching(
       if (ProfileAnchors != CalleeToCallsitesMap.end() &&
           !ProfileAnchors->second.empty()) {
         auto CI = ProfileAnchors->second.begin();
-        const auto &Candidate = *CI;
+        const auto Candidate = *CI;
         ProfileAnchors->second.erase(CI);
         InsertMatching(Loc, Candidate);
         LLVM_DEBUG(dbgs() << "Callsite with callee:" << CalleeName


        


More information about the llvm-commits mailing list