[llvm] [NFC][GlobalISel] Use move capture for SmallVector in LegalityPredicates lambdas (PR #193464)

Jaydeep Chauhan via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 09:39:27 PDT 2026


https://github.com/JaydeepChauhan14 updated https://github.com/llvm/llvm-project/pull/193464

>From 29117b0bcdff1ff1f0865961385592f455b9f7ab Mon Sep 17 00:00:00 2001
From: Chauhan Jaydeep Ashwinbhai <chauhan.jaydeep.ashwinbhai at intel.com>
Date: Wed, 22 Apr 2026 04:07:44 -0700
Subject: [PATCH] [NFC][GlobalISel] Use move capture for SmallVector in
 LegalityPredicates lambdas

---
 llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp b/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
index 5e7cd5fd5d9ad..247489f23e83f 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
@@ -43,7 +43,7 @@ LegalityPredicate LegalityPredicates::typePairInSet(
     unsigned TypeIdx0, unsigned TypeIdx1,
     std::initializer_list<std::pair<LLT, LLT>> TypesInit) {
   SmallVector<std::pair<LLT, LLT>, 4> Types = TypesInit;
-  return [=](const LegalityQuery &Query) {
+  return [=, Types = std::move(Types)](const LegalityQuery &Query) {
     std::pair<LLT, LLT> Match = {Query.Types[TypeIdx0], Query.Types[TypeIdx1]};
     return llvm::is_contained(Types, Match);
   };
@@ -53,7 +53,7 @@ LegalityPredicate LegalityPredicates::typeTupleInSet(
     unsigned TypeIdx0, unsigned TypeIdx1, unsigned TypeIdx2,
     std::initializer_list<std::tuple<LLT, LLT, LLT>> TypesInit) {
   SmallVector<std::tuple<LLT, LLT, LLT>, 4> Types = TypesInit;
-  return [=](const LegalityQuery &Query) {
+  return [=, Types = std::move(Types)](const LegalityQuery &Query) {
     std::tuple<LLT, LLT, LLT> Match = {
         Query.Types[TypeIdx0], Query.Types[TypeIdx1], Query.Types[TypeIdx2]};
     return llvm::is_contained(Types, Match);



More information about the llvm-commits mailing list