[llvm] [NFC] Use `std::move` to avoid copy (PR #134531)

via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 6 04:11:35 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-selectiondag

@llvm/pr-subscribers-backend-x86

Author: Abhishek Kaushik (abhishek-kaushik22)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/134531.diff


3 Files Affected:

- (modified) llvm/include/llvm/CodeGen/SelectionDAGNodes.h (+2-2) 
- (modified) llvm/lib/Target/X86/X86ISelLowering.cpp (+1-1) 
- (modified) llvm/utils/TableGen/SubtargetEmitter.cpp (+2-1) 


``````````diff
diff --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
index 2283f99202e2f..38b4ba89e26e6 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -3296,8 +3296,8 @@ namespace ISD {
                                   std::function<bool(ConstantSDNode *)> Match,
                                   bool AllowUndefs = false,
                                   bool AllowTruncation = false) {
-    return matchUnaryPredicateImpl<ConstantSDNode>(Op, Match, AllowUndefs,
-                                                   AllowTruncation);
+    return matchUnaryPredicateImpl<ConstantSDNode>(
+        Op, std::move(Match), AllowUndefs, AllowTruncation);
   }
 
   /// Hook for matching ConstantFPSDNode predicate
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 02398923ebc90..7bdb85f76be98 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -41005,7 +41005,7 @@ static SDValue combineX86ShufflesRecursively(
     resolveTargetShuffleFromZeroables(OpMask, OpUndef, OpZero,
                                       ResolveKnownZeros);
 
-    Mask = OpMask;
+    Mask = std::move(OpMask);
     Ops.append(OpInputs.begin(), OpInputs.end());
   } else {
     resolveTargetShuffleFromZeroables(OpMask, OpUndef, OpZero);
diff --git a/llvm/utils/TableGen/SubtargetEmitter.cpp b/llvm/utils/TableGen/SubtargetEmitter.cpp
index c398b6f9bf7cd..aa5e56e15859b 100644
--- a/llvm/utils/TableGen/SubtargetEmitter.cpp
+++ b/llvm/utils/TableGen/SubtargetEmitter.cpp
@@ -1054,7 +1054,8 @@ void SubtargetEmitter::expandProcResources(
         continue;
       ConstRecVec SuperResources = PR->getValueAsListOfDefs("Resources");
       bool AllContained =
-          all_of(SubResources, [SuperResources](const Record *SubResource) {
+          all_of(SubResources, [SuperResources = std::move(SuperResources)](
+                                   const Record *SubResource) {
             return is_contained(SuperResources, SubResource);
           });
       if (AllContained) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/134531


More information about the llvm-commits mailing list