[llvm] 66268c8 - [NFC]add & to avoid copy

via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 22:44:04 PDT 2023


Author: Wang, Xin10
Date: 2023-03-31T01:41:48-04:00
New Revision: 66268c8ec4dbccc7ec5fcc20d405cf0ffe4e91f4

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

LOG: [NFC]add & to avoid copy

The elements in FragmentMap are big objects, use reference can get
better performance, as someone do in line 1912.

Differential Revision: https://reviews.llvm.org/D147126

Added: 
    

Modified: 
    llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
index 00f4477826ba..a3b498335d3a 100644
--- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -2010,7 +2010,7 @@ static AssignmentTrackingLowering::OverlapMap buildOverlapMapAndRecordDeclares(
 
   // Build the map.
   AssignmentTrackingLowering::OverlapMap Map;
-  for (auto Pair : FragmentMap) {
+  for (auto &Pair : FragmentMap) {
     auto &Frags = Pair.second;
     for (auto It = Frags.begin(), IEnd = Frags.end(); It != IEnd; ++It) {
       DIExpression::FragmentInfo Frag = It->getFragmentOrDefault();


        


More information about the llvm-commits mailing list