Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ m_GFCstOrSplat(std::optional<FPValueAndVReg> &FPValReg) {
/// Matcher for a specific constant value.
struct SpecificConstantMatch {
APInt RequestedVal;
SpecificConstantMatch(const APInt RequestedVal)
SpecificConstantMatch(const APInt &RequestedVal)
: RequestedVal(RequestedVal) {}
bool match(const MachineRegisterInfo &MRI, Register Reg) {
APInt MatchedVal;
Expand Down
6 changes: 4 additions & 2 deletions llvm/include/llvm/CodeGen/GlobalISel/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,8 @@ LLVM_ABI bool isBuildVectorConstantSplat(const Register Reg,
/// G_BUILD_VECTOR_TRUNC where all of the elements are \p SplatValue or undef.
LLVM_ABI bool isBuildVectorConstantSplat(const Register Reg,
const MachineRegisterInfo &MRI,
APInt SplatValue, bool AllowUndef);
const APInt &SplatValue,
bool AllowUndef);

/// Return true if the specified instruction is a G_BUILD_VECTOR or
/// G_BUILD_VECTOR_TRUNC where all of the elements are \p SplatValue or undef.
Expand All @@ -475,7 +476,8 @@ LLVM_ABI bool isBuildVectorConstantSplat(const MachineInstr &MI,
/// G_BUILD_VECTOR_TRUNC where all of the elements are \p SplatValue or undef.
LLVM_ABI bool isBuildVectorConstantSplat(const MachineInstr &MI,
const MachineRegisterInfo &MRI,
APInt SplatValue, bool AllowUndef);
const APInt &SplatValue,
bool AllowUndef);

/// Return true if the specified instruction is a G_BUILD_VECTOR or
/// G_BUILD_VECTOR_TRUNC where all of the elements are 0 or undef.
Expand Down
6 changes: 4 additions & 2 deletions llvm/lib/CodeGen/GlobalISel/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,8 @@ bool llvm::isBuildVectorConstantSplat(const Register Reg,

bool llvm::isBuildVectorConstantSplat(const Register Reg,
const MachineRegisterInfo &MRI,
APInt SplatValue, bool AllowUndef) {
const APInt &SplatValue,
bool AllowUndef) {
if (auto SplatValAndReg = getAnyConstantSplat(Reg, MRI, AllowUndef)) {
if (SplatValAndReg->Value.getBitWidth() < SplatValue.getBitWidth())
return APInt::isSameValue(
Expand All @@ -1431,7 +1432,8 @@ bool llvm::isBuildVectorConstantSplat(const MachineInstr &MI,

bool llvm::isBuildVectorConstantSplat(const MachineInstr &MI,
const MachineRegisterInfo &MRI,
APInt SplatValue, bool AllowUndef) {
const APInt &SplatValue,
bool AllowUndef) {
return isBuildVectorConstantSplat(MI.getOperand(0).getReg(), MRI, SplatValue,
AllowUndef);
}
Expand Down