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

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 22:24:21 PDT 2026


Author: Jaydeep Chauhan
Date: 2026-04-23T10:54:17+05:30
New Revision: 66beeecd4694ef95f56800b6fe827572dd035640

URL: https://github.com/llvm/llvm-project/commit/66beeecd4694ef95f56800b6fe827572dd035640
DIFF: https://github.com/llvm/llvm-project/commit/66beeecd4694ef95f56800b6fe827572dd035640.diff

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

Fix lambda captures in `LegalityPredicates` to move `SmallVector`
instead of copying.

Added: 
    

Modified: 
    llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp

Removed: 
    


################################################################################
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