-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[NFC] Use std::move
to avoid copy
#134531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-tablegen @llvm/pr-subscribers-backend-x86 Author: Abhishek Kaushik (abhishek-kaushik22) ChangesFull diff: https://github.com/llvm/llvm-project/pull/134531.diff 3 Files Affected:
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) {
|
return matchUnaryPredicateImpl<ConstantSDNode>(Op, Match, AllowUndefs, | ||
AllowTruncation); | ||
return matchUnaryPredicateImpl<ConstantSDNode>( | ||
Op, std::move(Match), AllowUndefs, AllowTruncation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting - what warning / linter picked this up?
@@ -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)]( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just [&SuperResources]
?
@kazutakahirata is there an STL version of this - something like is_all_contained(SuperResources,SubResources)
?
No description provided.