23 User *
GEP,
bool NoAssumptions) {
25 Type *IntIdxTy =
DL.getIndexType(
GEP->getType());
26 Value *Result =
nullptr;
30 bool isInBounds = GEPOp->
isInBounds() && !NoAssumptions;
44 if (OpC->isZeroValue())
49 uint64_t OpValue = OpC->getUniqueInteger().getZExtValue();
50 uint64_t Size =
DL.getStructLayout(STy)->getElementOffset(OpValue);
60 if (IntIdxTy->
isVectorTy() && !
Op->getType()->isVectorTy())
62 cast<VectorType>(IntIdxTy)->getElementCount(),
Op);
65 if (
Op->getType() != IntIdxTy)
72 cast<VectorType>(IntIdxTy)->getElementCount(), Scale);
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static Constant * get(Type *Ty, uint64_t V, bool IsSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
This is an important base class in LLVM.
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
This class represents an Operation in the Expression.
A parsed version of the target data layout string in and methods for querying it.
bool isInBounds() const
Test whether this is an inbounds GEP, as defined by LangRef.html.
Common base class shared among various IRBuilders.
Value * CreateVectorSplat(unsigned NumElts, Value *V, const Twine &Name="")
Return a vector value that contains.
Value * CreateTypeSize(Type *DstType, TypeSize Size)
Create an expression which evaluates to the number of units in Size at runtime.
Value * CreateAdd(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Value * CreateIntCast(Value *V, Type *DestTy, bool isSigned, const Twine &Name="")
Value * CreateMul(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Class to represent struct types.
static constexpr TypeSize getFixed(ScalarTy ExactSize)
The instances of the Type class are immutable: once they are created, they are never changed.
bool isVectorTy() const
True if this is an instance of VectorType.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
A Use represents the edge between a Value definition and its users.
LLVM Value Representation.
StructType * getStructTypeOrNull() const
Type * getIndexedType() const
This is an optimization pass for GlobalISel generic memory operations.
Value * emitGEPOffset(IRBuilderBase *Builder, const DataLayout &DL, User *GEP, bool NoAssumptions=false)
Given a getelementptr instruction/constantexpr, emit the code necessary to compute the offset from th...
gep_type_iterator gep_type_begin(const User *GEP)