llvm::simplifyGEPInst

Given operands for a GetElementPtrInst, fold the result or return null.

Synopsis

Declared in <llvm/Analysis/InstructionSimplify.h>

Value*
simplifyGEPInst(
    Type* SrcTy,
    Value* Ptr,
    ArrayRef<Value*> Indices,
    GEPNoWrapFlags NW,
    SimplifyQuery const& Q);

Return Value

LLVM Value Representation

Parameters

NameDescription
SrcTyThe instances of the Type class are immutable: once they are created, they are never changed. Also note that only one instance of a particular type is ever created. Thus seeing if two types are equal is a matter of doing a trivial pointer comparison. To enforce that no two equal instances are created, Type instances can only be created via static factory methods in class Type and in derived classes. Once allocated, Types are never free'd.
PtrLLVM Value Representation
IndicesRepresent a constant reference to an array (0 or more elements consecutively in memory), i.e. a start pointer and a length. It allows various APIs to take consecutive elements easily and conveniently.
NWRepresents flags for the getelementptr instruction/expression. The following flags are supported: * inbounds (implies nusw) * nusw (no unsigned signed wrap) * nuw (no unsigned wrap) See LangRef for a description of their semantics.