Returns the distance between compatible pointers PtrA and PtrB.
Declared in <llvm/Analysis/LoopAccessAnalysis.h>
std::optional<int64_t>
getPointersDiff(
Type* ElemTyA,
Value* PtrA,
Type* ElemTyB,
Value* PtrB,
DataLayout const& DL,
ScalarEvolution& SE,
bool StrictCheck = false,
bool CheckType = true);
Returns the distance iff they are compatible and it is possible to calculate the distance between them. This is a simple API that does not depend on the analysis pass.
The distance between the pointers, or std::nullopt if not computable.
| Name | Description |
|---|---|
| ElemTyA | Element type of the access through PtrA. |
| PtrA | First pointer value. |
| ElemTyB | Element type of the access through PtrB. |
| PtrB | Second pointer value. |
| DL | Data layout used to compute type sizes and offsets. |
| SE | ScalarEvolution used to analyze the pointers. |
| StrictCheck | Ensure that the calculated distance matches the type-based one after all the bitcasts removal in the provided pointers. |
| CheckType | When true, require the element types to match. |