[llvm] Convert copy to r-value (PR #89053)

Isha Agarwal via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 17 04:34:15 PDT 2024


https://github.com/iagarwa created https://github.com/llvm/llvm-project/pull/89053

Avoid bigger objects copy

>From 25b9035ea0168d8f2f159e2d97aefef7535efd61 Mon Sep 17 00:00:00 2001
From: Isha Agarwal <isha.agarwal at intel.com>
Date: Wed, 17 Apr 2024 04:29:48 -0700
Subject: [PATCH] Convert copy to r-value

Avoid bigger objects copy

Signed-off-by: Isha Agarwal <isha.agarwal at intel.com>
---
 llvm/lib/MC/DXContainerPSVInfo.cpp      | 2 +-
 llvm/lib/Target/X86/X86ISelLowering.cpp | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/MC/DXContainerPSVInfo.cpp b/llvm/lib/MC/DXContainerPSVInfo.cpp
index aeff6938013977..38418893faa040 100644
--- a/llvm/lib/MC/DXContainerPSVInfo.cpp
+++ b/llvm/lib/MC/DXContainerPSVInfo.cpp
@@ -168,7 +168,7 @@ void PSVRuntimeInfo::finalize(Triple::EnvironmentType Stage) {
   DXConStrTabBuilder.add(EntryName);
 
   DXConStrTabBuilder.finalize();
-  for (auto ElAndName : zip(SignatureElements, SemanticNames)) {
+  for (auto &&ElAndName : zip(SignatureElements, SemanticNames)) {
     llvm::dxbc::PSV::v0::SignatureElement &El = std::get<0>(ElAndName);
     StringRef Name = std::get<1>(ElAndName);
     El.NameOffset = static_cast<uint32_t>(DXConStrTabBuilder.getOffset(Name));
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 27107f554fccf1..3c2c88e07c9da1 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -42702,7 +42702,7 @@ bool X86TargetLowering::isGuaranteedNotToBeUndefOrPoisonForTargetNode(
                              Mask)) {
       SmallVector<APInt, 2> DemandedSrcElts(Ops.size(),
                                             APInt::getZero(NumElts));
-      for (auto M : enumerate(Mask)) {
+      for (auto &&M : enumerate(Mask)) {
         if (!DemandedElts[M.index()] || M.value() == SM_SentinelZero)
           continue;
         if (M.value() == SM_SentinelUndef)
@@ -42711,7 +42711,7 @@ bool X86TargetLowering::isGuaranteedNotToBeUndefOrPoisonForTargetNode(
                "Shuffle mask index out of range");
         DemandedSrcElts[M.value() / NumElts].setBit(M.value() % NumElts);
       }
-      for (auto Op : enumerate(Ops))
+      for (auto &&Op : enumerate(Ops))
         if (!DemandedSrcElts[Op.index()].isZero() &&
             !DAG.isGuaranteedNotToBeUndefOrPoison(
                 Op.value(), DemandedSrcElts[Op.index()], PoisonOnly, Depth + 1))



More information about the llvm-commits mailing list