[llvm] Replace copy with a reference. (PR #82485)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 07:56:06 PST 2024


https://github.com/MalaySanghiIntel updated https://github.com/llvm/llvm-project/pull/82485

>From 5f182538e601b9fb3adaac9076210e0c0cc80578 Mon Sep 17 00:00:00 2001
From: Malay Sanghi <malay.sanghi at intel.com>
Date: Wed, 21 Feb 2024 03:24:43 -0800
Subject: [PATCH] Replace copy with a reference

These are relatively larger structures and we don't update them so ref
should be fine
---
 llvm/lib/CodeGen/MachinePipeliner.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 697e0da0944221..50529264eedd3b 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -1335,7 +1335,7 @@ class HighRegisterPressureDetector {
         Register Reg = getLoopPhiReg(*MI, OrigMBB);
         UpdateTargetRegs(Reg);
       } else {
-        for (auto Use : ROMap.find(MI)->getSecond().Uses)
+        for (auto &Use : ROMap.find(MI)->getSecond().Uses)
           UpdateTargetRegs(Use.RegUnit);
       }
     }
@@ -1439,7 +1439,7 @@ class HighRegisterPressureDetector {
 
         const unsigned Iter = I - Stage;
 
-        for (auto Def : ROMap.find(MI)->getSecond().Defs)
+        for (auto &Def : ROMap.find(MI)->getSecond().Defs)
           InsertReg(LiveRegSets[Iter], Def.RegUnit);
 
         for (auto LastUse : LastUses[MI]) {



More information about the llvm-commits mailing list