[llvm] 0c36ab1 - [NFC] Fix auto usage to avoid copies

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 24 02:29:56 PDT 2023


Author: Akshay Khadse
Date: 2023-03-24T17:29:48+08:00
New Revision: 0c36ab19081fd45d2894ada7b6d2852161a4310f

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

LOG: [NFC] Fix auto usage to avoid copies

Fixes some usages of the "auto" keyword to avoid creation of copies.

Reviewed By: LuoYuanke

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

Added: 
    

Modified: 
    llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
index 8b0ab67cb9185..e43824198af49 100644
--- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -854,15 +854,15 @@ class MemLocFragmentFill {
     }
 
     // Insert new location defs.
-    for (auto Pair : BBInsertBeforeMap) {
+    for (auto &Pair : BBInsertBeforeMap) {
       InsertMap &Map = Pair.second;
-      for (auto Pair : Map) {
+      for (auto &Pair : Map) {
         Instruction *InsertBefore = Pair.first;
         assert(InsertBefore && "should never be null");
         auto FragMemLocs = Pair.second;
         auto &Ctx = Fn.getContext();
 
-        for (auto FragMemLoc : FragMemLocs) {
+        for (auto &FragMemLoc : FragMemLocs) {
           DIExpression *Expr = DIExpression::get(Ctx, std::nullopt);
           Expr = *DIExpression::createFragmentExpression(
               Expr, FragMemLoc.OffsetInBits, FragMemLoc.SizeInBits);


        


More information about the llvm-commits mailing list