Index: llvm/include/llvm/Transforms/IPO/Attributor.h =================================================================== --- llvm/include/llvm/Transforms/IPO/Attributor.h +++ llvm/include/llvm/Transforms/IPO/Attributor.h @@ -1682,6 +1682,36 @@ static const char ID; }; +/// An abstract interface to determine reachability of point A to B. +struct AAReachability : public StateWrapper, + public IRPosition { + AAReachability(const IRPosition &IRP) : IRPosition(IRP) {} + + /// Returns true if 'From' instruction is assumed to reach, 'To' instruction. + /// Users should provide two positions they are interested in, and the class + /// determines (and caches) reachability. + bool isAssumedReachable(const IRPosition &From, const IRPosition &To) const { + return true; + } + + /// Returns true if 'From' instruction is known to reach, 'To' instruction. + /// Users should provide two positions they are interested in, and the class + /// determines (and caches) reachability. + bool isKnownReachable(const IRPosition &From, const IRPosition &To) const { + return true; + } + + /// Return an IR position, see struct IRPosition. + const IRPosition &getIRPosition() const override { return *this; } + + /// Create an abstract attribute view for the position \p IRP. + static AAReachability &createForPosition(const IRPosition &IRP, + Attributor &A); + + /// Unique ID (due to the unique address) + static const char ID; +}; + /// An abstract interface for all noalias attributes. struct AANoAlias : public IRAttribute