llvm::ConstantFoldGetElementPtr

Attempt to constant fold a getelementptr instruction with the specified operands.

Synopsis

Declared in <llvm/IR/ConstantFold.h>

Constant*
ConstantFoldGetElementPtr(
    Type* Ty,
    Constant* C,
    std::optional<ConstantRange> InRange,
    ArrayRef<Value*> Idxs);

Description

The constant result is returned if successful; if not, null is returned.

Return Value

The folded constant, or null if the GEP cannot be folded.

Parameters

NameDescription
TyThe source element type for the GEP.
CThe pointer operand.
InRangeThe inrange range if present, or std::nullopt.
IdxsThe index operands.