Analyze the specified pointer to see if it can be expressed as a base pointer plus a constant offset. Return the base and offset to the caller.

Synopsis

Declared in <llvm/Analysis/ValueTracking.h>

Value*
GetPointerBaseWithConstantOffset(
    Value* Ptr,
    int64_t& Offset,
    DataLayout const& DL,
    bool AllowNonInbounds = true);

Description

This is a wrapper around Value::stripAndAccumulateConstantOffsets that creates and later unpacks the required APInt.

Return Value

Base pointer after stripping constant offsets.

Parameters

Name

Description

Ptr

Pointer to decompose into base plus offset.

Offset

Output constant offset from the returned base.

DL

Data layout used for pointer index sizes.

AllowNonInbounds

Whether non‐inbounds GEPs may contribute offsets.

Created with MrDocs