46 const SCEV *AS = SE.getSCEV(
const_cast<Value *
>(LocA.
Ptr));
47 const SCEV *BS = SE.getSCEV(
const_cast<Value *
>(LocB.
Ptr));
69 SE.getPtrToIntExpr(AS, SE.getEffectiveSCEVType(AS->
getType()));
71 SE.getPtrToIntExpr(BS, SE.getEffectiveSCEVType(BS->
getType()));
78 const SCEV *BA = SE.getMinusSCEV(BS, AS);
84 ASizeInt.
ule(SE.getUnsignedRange(BA).getUnsignedMin()) &&
85 (-BSizeInt).uge(SE.getUnsignedRange(BA).getUnsignedMax()))
93 const SCEV *AB = SE.getMinusSCEV(AS, BS);
99 BSizeInt.
ule(SE.getUnsignedRange(AB).getUnsignedMin()) &&
100 (-ASizeInt).uge(SE.getUnsignedRange(AB).getUnsignedMax()))
107 Value *AO = GetBaseValue(AS);
108 Value *BO = GetBaseValue(BS);
109 if ((AO && AO != LocA.
Ptr) || (BO && BO != LocB.
Ptr))
127Value *SCEVAAResult::GetBaseValue(
const SCEV *S) {
131 return GetBaseValue(AR->getStart());
134 const SCEV *
Last =
A->getOperand(
A->getNumOperands() - 1);
135 if (
Last->getType()->isPointerTy())
136 return GetBaseValue(
Last);
139 return U->getValue();
146 FunctionAnalysisManager::Invalidator &Inv) {
160 "ScalarEvolution-based Alias Analysis",
false,
true)
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
static bool canComputePointerDiff(ScalarEvolution &SE, const SCEV *A, const SCEV *B)
This is the interface for a SCEV-based alias analysis.
This class stores info we want to provide to or retain within an alias query.
Class for arbitrary precision integers.
bool ule(const APInt &RHS) const
Unsigned less or equal comparison.
The possible results of an alias query.
@ MayAlias
The two locations may or may not alias.
@ NoAlias
The two locations do not alias at all.
@ MustAlias
The two locations precisely alias each other.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
FunctionPass class - This class is used to implement most global optimizations.
static constexpr LocationSize beforeOrAfterPointer()
Any location before or after the base pointer (but still within the underlying object).
TypeSize getValue() const
Representation for a specific memory location.
LocationSize Size
The maximum size of the location, in address-units, or UnknownSize if the size is not known.
AAMDNodes AATags
The metadata nodes which describes the aliasing of the location (each member is null if that kind of ...
const Value * Ptr
The address of the start of the location.
AnalysisType & getAnalysis() const
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information ...
A set of analyses that are preserved following a run of a transformation pass.
A simple alias analysis implementation that uses ScalarEvolution to answer queries.
LLVM_ABI bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &Inv)
LLVM_ABI AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI, const Instruction *CtxI)
Legacy wrapper pass to provide the SCEVAAResult object.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
LLVM_ABI SCEVAAResult run(Function &F, FunctionAnalysisManager &AM)
This node represents an addition of some number of SCEVs.
This node represents a polynomial recurrence on the trip count of the specified loop.
This class represents an analyzed expression in the program.
LLVM_ABI Type * getType() const
Return the LLVM type of this SCEV expression.
Analysis pass that exposes the ScalarEvolution for a function.
The main scalar evolution driver.
LLVM_ABI Type * getEffectiveSCEVType(Type *Ty) const
Return a type with the same bitwidth as the given type and which represents how SCEV will treat the g...
LLVM_ABI bool instructionCouldExistWithOperands(const SCEV *A, const SCEV *B)
Return true if there exists a point in the program at which both A and B could be operands to the sam...
LLVM Value Representation.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI FunctionPass * createSCEVAAWrapperPass()
Creates an instance of SCEVAAWrapperPass.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
constexpr unsigned BitWidth
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
A special type used by analysis passes to provide an address that identifies that particular analysis...