llvm::Value::getPointerOffsetFrom

If this ptr is provably equal to Other plus a constant offset, return that offset in bytes. Essentially ptr this subtract ptr Other.

Synopsis

Declared in <llvm/IR/Value.h>

std::optional<int64_t>
getPointerOffsetFrom(
    Value const* Other,
    DataLayout const& DL) const;

Return Value

The constant byte offset, or nullopt if not provable.

Parameters

NameDescription
OtherPointer to compare against.
DLData layout used to compute the offset.