[llvm] Use `std::move` to avoid copy (PR #113054)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 19 12:27:29 PDT 2024
https://github.com/abhishek-kaushik22 updated https://github.com/llvm/llvm-project/pull/113054
>From 76050379ac9d7d485bedf2661bd10a900379f582 Mon Sep 17 00:00:00 2001
From: abhishek-kaushik22 <abhishek.kaushik at intel.com>
Date: Sat, 19 Oct 2024 22:43:52 +0530
Subject: [PATCH 1/5] Use `std::move` to avoid redundant copy
---
llvm/utils/TableGen/DecoderEmitter.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index 4d2320b31ea94a..55af5fdc3d6a37 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -2059,7 +2059,7 @@ populateInstruction(const CodeGenTarget &Target, const Record &EncodingDef,
MyName = Op.Name;
TiedNames[MyName] = TiedName;
- TiedNames[TiedName] = MyName;
+ TiedNames[TiedName] = std::move(MyName);
}
}
}
>From 014565eb49b5855e3da164040f976b4fbf342521 Mon Sep 17 00:00:00 2001
From: abhishek-kaushik22 <abhishek.kaushik at intel.com>
Date: Sat, 19 Oct 2024 22:52:50 +0530
Subject: [PATCH 2/5] Use `std::move` to avoid copy
---
llvm/utils/TableGen/DecoderEmitter.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index 55af5fdc3d6a37..a9e05bcaeff68c 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -1893,7 +1893,7 @@ OperandInfo getOpInfo(const Record *TypeRecord) {
bool HasCompleteDecoder =
HasCompleteDecoderBit ? HasCompleteDecoderBit->getValue() : true;
- return OperandInfo(Decoder, HasCompleteDecoder);
+ return OperandInfo(std::move(Decoder), HasCompleteDecoder);
}
static void parseVarLenInstOperand(const Record &Def,
>From c0e13d2f51234c4f610d2eddadd0b5acefba4e3f Mon Sep 17 00:00:00 2001
From: abhishek-kaushik22 <abhishek.kaushik at intel.com>
Date: Sat, 19 Oct 2024 23:02:40 +0530
Subject: [PATCH 3/5] Update DecoderEmitter.cpp
---
llvm/utils/TableGen/DecoderEmitter.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index a9e05bcaeff68c..9c313e19d2d182 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -2024,7 +2024,7 @@ populateInstruction(const CodeGenTarget &Target, const Record &EncodingDef,
EncodingDef.getValueAsBit("hasCompleteDecoder");
InsnOperands.push_back(
OperandInfo(std::string(InstDecoder), HasCompleteInstDecoder));
- Operands[Opc] = InsnOperands;
+ Operands[Opc] = std::move(InsnOperands);
return Bits.getNumBits();
}
>From 7c6848ad3c60d96df46faa2235b3a072194385fe Mon Sep 17 00:00:00 2001
From: abhishek-kaushik22 <abhishek.kaushik at intel.com>
Date: Sat, 19 Oct 2024 23:09:50 +0530
Subject: [PATCH 4/5] Update DecoderEmitter.cpp
---
llvm/utils/TableGen/DecoderEmitter.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index 9c313e19d2d182..12f5fc30d34eb7 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -2143,7 +2143,7 @@ populateInstruction(const CodeGenTarget &Target, const Record &EncodingDef,
// instruction! (This is a longstanding bug, which will be addressed in an
// upcoming change.)
if (OpInfo.numFields() > 0)
- InsnOperands.push_back(OpInfo);
+ InsnOperands.push_back(std::move(OpInfo));
}
}
Operands[Opc] = InsnOperands;
>From 2ce9d2a4aa7d14c9afd4ef0d29e8f9792647d30e Mon Sep 17 00:00:00 2001
From: abhishek-kaushik22 <abhishek.kaushik at intel.com>
Date: Sun, 20 Oct 2024 00:57:20 +0530
Subject: [PATCH 5/5] Update DecoderEmitter.cpp
---
llvm/utils/TableGen/DecoderEmitter.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index 12f5fc30d34eb7..90a6d0ee8acb57 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -2112,7 +2112,7 @@ populateInstruction(const CodeGenTarget &Target, const Record &EncodingDef,
addOneOperandFields(EncodingDef, Bits, TiedNames, SubOpName,
SubOpInfo);
- InsnOperands.push_back(SubOpInfo);
+ InsnOperands.push_back(std::move(SubOpInfo));
}
continue;
}
More information about the llvm-commits
mailing list