48 "ScalableVectorType is not supported.");
59 return std::min<unsigned>(PartNumElems,
Size - Part * PartNumElems);
78 if (BB !=
II->getParent())
91 Value *FirstNonUndef =
nullptr;
99 if (V != FirstNonUndef)
102 return FirstNonUndef !=
nullptr;
114 return std::all_of(It, VL.
end(), [&](
Value *V) {
115 if (auto *CI = dyn_cast<CmpInst>(V))
116 return BasePred == CI->getPredicate();
117 if (auto *I = dyn_cast<Instruction>(V))
118 return I->getOpcode() == Opcode;
119 return isa<PoisonValue>(V);
124 unsigned Opcode = E->getOpcode();
125 assert((Opcode == Instruction::ExtractElement ||
126 Opcode == Instruction::ExtractValue) &&
127 "Expected extractelement or extractvalue instruction.");
128 if (Opcode == Instruction::ExtractElement) {
134 unsigned Idx = CI->getZExtValue();
142 if (EI->getNumIndices() != 1)
144 return *EI->idx_begin();
149 return all_of(VL, [&](
Value *V) {
return V->getType() == Ty; });
155 static_assert(std::is_same_v<T, InsertElementInst> ||
156 std::is_same_v<T, ExtractElementInst>,
163 constexpr bool IsInsert = std::is_same_v<T, InsertElementInst>;
164 Type *VecTy = IsInsert ? IE->getType() : IE->getOperand(0)->getType();
171 if (CI->getValue().uge(VT->getNumElements()))
174 Index *= VT->getNumElements();
175 Index += CI->getZExtValue();
181template std::optional<unsigned>
183template std::optional<unsigned>
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
uint64_t IntrinsicInst * II
Represent a constant reference to an array (0 or more elements consecutively in memory),...
const T & consume_front()
consume_front() - Returns the first element and drops it from ArrayRef.
LLVM Basic Block Representation.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
constexpr ScalarTy getFixedValue() const
const ParentTy * getParent() const
A private "module" namespace for types and utilities used by this pass.
std::optional< unsigned > getExtractIndex(const Instruction *E)
std::optional< unsigned > getInsertExtractIndex(const Value *Inst, unsigned Offset)
bool allSameType(ArrayRef< Value * > VL)
bool allSameOpcode(ArrayRef< Value * > VL)
bool isSplat(ArrayRef< Value * > VL)
unsigned getNumElements(Type *Ty)
unsigned getPartNumElems(unsigned Size, unsigned NumParts)
Returns power-of-2 number of elements in a single register (part), given the total number of elements...
bool allConstant(ArrayRef< Value * > VL)
template std::optional< unsigned > getInsertExtractIndex< InsertElementInst >(const Value *, unsigned)
bool allSameBlock(ArrayRef< Value * > VL)
bool isVectorLikeInstWithConstOps(Value *V)
Checks if V is one of vector-like instructions, i.e.
unsigned getNumElems(unsigned Size, unsigned PartNumElems, unsigned Part)
Returns correct remaining number of elements, considering total amount Size, (power-of-2 number) of e...
bool isConstant(Value *V)
template std::optional< unsigned > getInsertExtractIndex< ExtractElementInst >(const Value *, unsigned)
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
bool isVectorizedTy(Type *Ty)
Returns true if Ty is a vector type or a struct of vector types where all vector types share the same...
T bit_ceil(T Value)
Returns the smallest integral power of two no smaller than Value if Value is nonzero.
ElementCount getVectorizedTypeVF(Type *Ty)
Returns the number of vector elements for a vectorized type.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
iterator_range(Container &&) -> iterator_range< llvm::detail::IterOfRange< Container > >
constexpr T divideCeil(U Numerator, V Denominator)
Returns the integer ceil(Numerator / Denominator).
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
constexpr detail::IsaCheckPredicate< Types... > IsaPred
Function object wrapper for the llvm::isa type check.