27#define DEBUG_TYPE "gi-combiner"
30using namespace MIPatternMatch;
71 std::optional<ValueAndVReg> MaybeIndex =
73 std::optional<APInt> IndexC = std::nullopt;
76 IndexC = MaybeIndex->Value;
113 std::optional<ValueAndVReg> MaybeIndex =
115 std::optional<APInt> IndexC = std::nullopt;
120 IndexC = MaybeIndex->Value;
125 getOpcodeDef<GInsertVectorElement>(
Vector,
MRI);
131 std::optional<ValueAndVReg> MaybeInsertIndex =
134 if (MaybeInsertIndex && MaybeInsertIndex->Value != *IndexC) {
139 B.buildExtractVectorElement(Dst, Insert->getVectorReg(),
Index);
194 B.buildFreeze(Dst, Extract);
244 std::optional<ValueAndVReg> MaybeIndex =
255 B.buildCopy(Dst, Build->
getSourceReg(MaybeIndex->Value.getZExtValue()));
305 std::optional<ValueAndVReg> MaybeIndex =
322 B.buildTrunc(Dst, Build->
getSourceReg(MaybeIndex->Value.getZExtValue()));
339 std::optional<ValueAndVReg> MaybeIndex =
342 if (MaybeIndex && MaybeIndex->Value.uge(DstTy.
getNumElements()) &&
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This contains common combine transformations that may be used in a combine pass,or by the target else...
Declares convenience wrapper classes for interpreting MachineInstr instances as specific generic oper...
Interface for Targets to specify which operations they can successfully select and how the others sho...
Implement a low-level type suitable for MachineInstr level instruction selection.
Contains matchers for matching SSA Machine Instructions.
This file declares the MachineIRBuilder class.
This file describes how to lower LLVM code to machine code.
bool matchExtractVectorElementWithFreeze(const MachineOperand &MO, BuildFnTy &MatchInfo)
Combine extract vector element with freeze on the vector register.
bool matchExtractVectorElementWithDifferentIndices(const MachineOperand &MO, BuildFnTy &MatchInfo)
Combine extract vector element with a insert vector element on the vector register and different indi...
bool matchExtractVectorElementWithBuildVectorTrunc(const MachineOperand &MO, BuildFnTy &MatchInfo)
Combine extract vector element with a build vector trunc on the vector register.
const TargetLowering & getTargetLowering() const
bool matchInsertVectorElementOOB(MachineInstr &MI, BuildFnTy &MatchInfo)
Combine insert vector element OOB.
MachineRegisterInfo & MRI
bool isLegalOrBeforeLegalizer(const LegalityQuery &Query) const
bool matchExtractVectorElementWithBuildVector(const MachineOperand &MO, BuildFnTy &MatchInfo)
Combine extract vector element with a build vector on the vector register.
bool matchExtractVectorElement(MachineInstr &MI, BuildFnTy &MatchInfo)
Combine extract vector element.
Represents a G_BUILD_VECTOR_TRUNC.
Represents a G_BUILD_VECTOR.
Register getSourceReg() const
Represents an insert vector element.
Register getSourceReg(unsigned I) const
Returns the I'th source register.
Register getReg(unsigned Idx) const
Access the Idx'th operand as a register and return it.
constexpr uint16_t getNumElements() const
Returns the number of elements in a vector LLT.
constexpr bool isFixedVector() const
Returns true if the LLT is a fixed vector.
Helper class to build MachineInstr.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
Register getReg() const
getReg - Returns the register number.
bool hasOneNonDBGUse(Register RegNo) const
hasOneNonDBGUse - Return true if there is exactly one non-Debug use of the specified register.
LLT getType(Register Reg) const
Get the low-level type of Reg or LLT{} if Reg is not a generic (target independent) virtual register.
Wrapper class representing virtual and physical registers.
This is an optimization pass for GlobalISel generic memory operations.
MVT getMVTForLLT(LLT Ty)
Get a rough equivalent of an MVT for a given LLT.
MachineInstr * getDefIgnoringCopies(Register Reg, const MachineRegisterInfo &MRI)
Find the def instruction for Reg, folding away any trivial copies.
std::function< void(MachineIRBuilder &)> BuildFnTy
std::optional< ValueAndVReg > getIConstantVRegValWithLookThrough(Register VReg, const MachineRegisterInfo &MRI, bool LookThroughInstrs=true)
If VReg is defined by a statically evaluable chain of instructions rooted on a G_CONSTANT returns its...