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

via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 19 10:59:03 PDT 2024


https://github.com/abhishek-kaushik22 updated https://github.com/llvm/llvm-project/pull/113057

>From 45dbc4e57c27ef43f19036b6fa4e429a62c5ad56 Mon Sep 17 00:00:00 2001
From: abhishek-kaushik22 <abhishek.kaushik at intel.com>
Date: Sat, 19 Oct 2024 23:22:34 +0530
Subject: [PATCH 1/2] Use `std::move` to avoid copy

---
 llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
index d2228c902a56b4..5d9cf7fa97c99d 100644
--- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
@@ -3175,7 +3175,7 @@ void TreePattern::dump() const { print(errs()); }
 CodeGenDAGPatterns::CodeGenDAGPatterns(const RecordKeeper &R,
                                        PatternRewriterFn PatternRewriter)
     : Records(R), Target(R), Intrinsics(R),
-      LegalVTS(Target.getLegalValueTypes()), PatternRewriter(PatternRewriter) {
+      LegalVTS(Target.getLegalValueTypes()), PatternRewriter(std::move(PatternRewriter)) {
   ParseNodeInfo();
   ParseNodeTransforms();
   ParseComplexPatterns();

>From 853e4c90f2beb5bb590a8779c592c0c30cc36bd9 Mon Sep 17 00:00:00 2001
From: abhishek-kaushik22 <abhishek.kaushik at intel.com>
Date: Sat, 19 Oct 2024 23:28:56 +0530
Subject: [PATCH 2/2] Update CodeGenDAGPatterns.cpp

---
 llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
index 5d9cf7fa97c99d..eb1ba1359138d5 100644
--- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
@@ -3175,7 +3175,8 @@ void TreePattern::dump() const { print(errs()); }
 CodeGenDAGPatterns::CodeGenDAGPatterns(const RecordKeeper &R,
                                        PatternRewriterFn PatternRewriter)
     : Records(R), Target(R), Intrinsics(R),
-      LegalVTS(Target.getLegalValueTypes()), PatternRewriter(std::move(PatternRewriter)) {
+      LegalVTS(Target.getLegalValueTypes()), 
+      PatternRewriter(std::move(PatternRewriter)) {
   ParseNodeInfo();
   ParseNodeTransforms();
   ParseComplexPatterns();



More information about the llvm-commits mailing list