llvm::canReplacePointersIfEqual

Returns true if pointer From can be replaced with equal pointer To.

Synopsis

Declared in <llvm/Analysis/Loads.h>

bool
canReplacePointersIfEqual(
    Value const* From,
    Value const* To,
    DataLayout const& DL);

Description

The pointers are deemed equal through some means (e.g. information from conditions). NOTE: The current implementation allows replacement in Icmp and PtrToInt instructions, as well as when we are replacing with a null pointer. Additionally it also allows replacement of pointers when both pointers have the same underlying object.

Return Value

True if pointer From can be replaced with equal pointer To.

Parameters

NameDescription
FromPointer value that would be replaced.
ToPointer value that would replace From.
DLData layout used for pointer-size reasoning.