[llvm] Replace copy with a reference. (PR #82485)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 21 04:04:04 PST 2024
https://github.com/MalaySanghiIntel created https://github.com/llvm/llvm-project/pull/82485
These are relatively larger structures and we don't update them so ref should be fine
>From 2fa5f6f25709b65192882094129ee3b45be91b66 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 ++--
llvm/lib/CodeGen/SelectOptimize.cpp | 2 +-
2 files changed, 3 insertions(+), 3 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]) {
diff --git a/llvm/lib/CodeGen/SelectOptimize.cpp b/llvm/lib/CodeGen/SelectOptimize.cpp
index 31c4b63698b5de..5925e989e52a2a 100644
--- a/llvm/lib/CodeGen/SelectOptimize.cpp
+++ b/llvm/lib/CodeGen/SelectOptimize.cpp
@@ -712,7 +712,7 @@ void SelectOptimizeImpl::convertProfitableSIGroups(SelectGroups &ProfSIGroups) {
SI.getCondition()->getName() + ".frozen");
SmallPtrSet<const Instruction *, 2> INS;
- for (auto SI : ASI)
+ for (auto &SI : ASI)
INS.insert(SI.getI());
// Use reverse iterator because later select may use the value of the
More information about the llvm-commits
mailing list