14 #ifndef LLVM_ANALYSIS_BASICALIASANALYSIS_H
15 #define LLVM_ANALYSIS_BASICALIASANALYSIS_H
30 class AssumptionCache;
53 :
AAResultBase(), DL(DL), TLI(TLI), AC(AC), DT(DT), LI(LI) {}
56 :
AAResultBase(Arg), DL(Arg.DL), TLI(Arg.TLI), AC(Arg.AC), DT(Arg.DT),
59 :
AAResultBase(std::move(Arg)), DL(Arg.DL), TLI(Arg.TLI), AC(Arg.AC),
60 DT(Arg.DT), LI(Arg.LI) {}
88 struct VariableGEPIndex {
102 bool operator==(
const VariableGEPIndex &Other)
const {
103 return V == Other.V && ZExtBits == Other.ZExtBits &&
104 SExtBits == Other.SExtBits && Scale == Other.Scale;
107 bool operator!=(
const VariableGEPIndex &Other)
const {
114 struct DecomposedGEP {
118 int64_t StructOffset;
123 SmallVector<VariableGEPIndex, 4> VarIndices;
127 typedef std::pair<MemoryLocation, MemoryLocation> LocPair;
128 typedef SmallDenseMap<LocPair, AliasResult, 8> AliasCacheTy;
129 AliasCacheTy AliasCache;
145 SmallPtrSet<const BasicBlock *, 8> VisitedPhiBBs;
148 SmallPtrSet<const Value *, 16> Visited;
151 GetLinearExpression(
const Value *V, APInt &Scale, APInt &
Offset,
152 unsigned &ZExtBits,
unsigned &SExtBits,
153 const DataLayout &DL,
unsigned Depth, AssumptionCache *AC,
154 DominatorTree *DT,
bool &NSW,
bool &NUW);
156 static bool DecomposeGEPExpression(
const Value *V, DecomposedGEP &Decomposed,
157 const DataLayout &DL, AssumptionCache *AC, DominatorTree *DT);
159 static bool isGEPBaseAtNegativeOffset(
const GEPOperator *GEPOp,
160 const DecomposedGEP &DecompGEP,
const DecomposedGEP &DecompObject,
161 uint64_t ObjectAccessSize);
172 constantOffsetHeuristic(
const SmallVectorImpl<VariableGEPIndex> &VarIndices,
173 uint64_t V1Size, uint64_t V2Size, int64_t BaseOffset,
174 AssumptionCache *AC, DominatorTree *DT);
176 bool isValueEqualInPotentialCycles(
const Value *V1,
const Value *
V2);
178 void GetIndexDifference(SmallVectorImpl<VariableGEPIndex> &Dest,
179 const SmallVectorImpl<VariableGEPIndex> &Src);
181 AliasResult aliasGEP(
const GEPOperator *V1, uint64_t V1Size,
182 const AAMDNodes &V1AAInfo,
const Value *
V2,
183 uint64_t V2Size,
const AAMDNodes &V2AAInfo,
184 const Value *UnderlyingV1,
const Value *UnderlyingV2);
186 AliasResult aliasPHI(
const PHINode *PN, uint64_t PNSize,
187 const AAMDNodes &PNAAInfo,
const Value *
V2,
188 uint64_t V2Size,
const AAMDNodes &V2AAInfo,
189 const Value *UnderV2);
191 AliasResult aliasSelect(
const SelectInst *SI, uint64_t SISize,
192 const AAMDNodes &SIAAInfo,
const Value *
V2,
193 uint64_t V2Size,
const AAMDNodes &V2AAInfo,
194 const Value *UnderV2);
196 AliasResult aliasCheck(
const Value *V1, uint64_t V1Size, AAMDNodes V1AATag,
197 const Value *
V2, uint64_t V2Size, AAMDNodes V2AATag,
198 const Value *O1 =
nullptr,
const Value *O2 =
nullptr);
214 std::unique_ptr<BasicAAResult> Result;
216 virtual void anchor();
bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &Inv)
Handle invalidation events in the new pass manager.
A parsed version of the target data layout string in and methods for querying it. ...
BasicAAResult(const DataLayout &DL, const TargetLibraryInfo &TLI, AssumptionCache &AC, DominatorTree *DT=nullptr, LoopInfo *LI=nullptr)
BasicAAResult createLegacyPMBasicAAResult(Pass &P, Function &F)
A helper for the legacy pass manager to create a BasicAAResult object populated to the best of our ab...
aarch64 AArch64 CCMP Pass
A cache of .assume calls within a function.
This is the AA result object for the basic, local, and stateless alias analysis.
bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal)
Chases pointers until we find a (constant global) or not.
ModRefInfo
Flags indicating whether a memory access modifies or references memory.
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass...
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
A CRTP-driven "mixin" base class to help implement the function alias analysis results concept...
FunctionModRefBehavior
Summary of how a function affects memory in the program.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
A set of analyses that are preserved following a run of a transformation pass.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
A CRTP mix-in that provides informational APIs needed for analysis passes.
FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS)
Returns the behavior when calling the given call site.
AliasResult
The possible results of an alias query.
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc)
Checks to see if the specified callsite can clobber the specified memory object.
Representation for a specific memory location.
BasicAAResult & getResult()
Module.h This file contains the declarations for the Module class.
Provides information about what library functions are available for the current target.
FunctionPass * createBasicAAWrapperPass()
Analysis pass providing a never-invalidated alias analysis result.
bool operator!=(uint64_t V1, const APInt &V2)
BasicAAResult(BasicAAResult &&Arg)
BasicAAResult(const BasicAAResult &Arg)
ImmutableCallSite - establish a view to a call site for examination.
const BasicAAResult & getResult() const
BasicAAResult run(Function &F, FunctionAnalysisManager &AM)
API to communicate dependencies between analyses during invalidation.
LLVM Value Representation.
ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx)
Get the location associated with a pointer argument of a callsite.
A container for analyses that lazily runs them and caches their results.
bool operator==(uint64_t V1, const APInt &V2)
This header defines various interfaces for pass management in LLVM.
A special type used by analysis passes to provide an address that identifies that particular analysis...
Legacy wrapper pass to provide the BasicAAResult object.