Skip to content

Commit 655658c

Browse files
abhishek-kaushik22aokblast
authored andcommitted
[NFC][GISel] Pass APInt by const reference (llvm#164556)
Change function signature to avoid copying the argument at call site.
1 parent 4fdc774 commit 655658c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ struct SpecificConstantMatch {
210210
};
211211

212212
/// Matches a constant equal to \p RequestedValue.
213-
inline SpecificConstantMatch m_SpecificICst(APInt RequestedValue) {
214-
return SpecificConstantMatch(std::move(RequestedValue));
213+
inline SpecificConstantMatch m_SpecificICst(const APInt &RequestedValue) {
214+
return SpecificConstantMatch(RequestedValue);
215215
}
216216

217217
inline SpecificConstantMatch m_SpecificICst(int64_t RequestedValue) {
@@ -221,7 +221,7 @@ inline SpecificConstantMatch m_SpecificICst(int64_t RequestedValue) {
221221
/// Matcher for a specific constant splat.
222222
struct SpecificConstantSplatMatch {
223223
APInt RequestedVal;
224-
SpecificConstantSplatMatch(const APInt RequestedVal)
224+
SpecificConstantSplatMatch(const APInt &RequestedVal)
225225
: RequestedVal(RequestedVal) {}
226226
bool match(const MachineRegisterInfo &MRI, Register Reg) {
227227
return isBuildVectorConstantSplat(Reg, MRI, RequestedVal,
@@ -230,8 +230,9 @@ struct SpecificConstantSplatMatch {
230230
};
231231

232232
/// Matches a constant splat of \p RequestedValue.
233-
inline SpecificConstantSplatMatch m_SpecificICstSplat(APInt RequestedValue) {
234-
return SpecificConstantSplatMatch(std::move(RequestedValue));
233+
inline SpecificConstantSplatMatch
234+
m_SpecificICstSplat(const APInt &RequestedValue) {
235+
return SpecificConstantSplatMatch(RequestedValue);
235236
}
236237

237238
inline SpecificConstantSplatMatch m_SpecificICstSplat(int64_t RequestedValue) {
@@ -242,7 +243,7 @@ inline SpecificConstantSplatMatch m_SpecificICstSplat(int64_t RequestedValue) {
242243
/// Matcher for a specific constant or constant splat.
243244
struct SpecificConstantOrSplatMatch {
244245
APInt RequestedVal;
245-
SpecificConstantOrSplatMatch(const APInt RequestedVal)
246+
SpecificConstantOrSplatMatch(const APInt &RequestedVal)
246247
: RequestedVal(RequestedVal) {}
247248
bool match(const MachineRegisterInfo &MRI, Register Reg) {
248249
APInt MatchedVal;
@@ -263,8 +264,8 @@ struct SpecificConstantOrSplatMatch {
263264
/// Matches a \p RequestedValue constant or a constant splat of \p
264265
/// RequestedValue.
265266
inline SpecificConstantOrSplatMatch
266-
m_SpecificICstOrSplat(APInt RequestedValue) {
267-
return SpecificConstantOrSplatMatch(std::move(RequestedValue));
267+
m_SpecificICstOrSplat(const APInt &RequestedValue) {
268+
return SpecificConstantOrSplatMatch(RequestedValue);
268269
}
269270

270271
inline SpecificConstantOrSplatMatch

0 commit comments

Comments
 (0)