55 errs() <<
" " << AR <<
":\t" << o1 <<
", " << o2 <<
"\n";
62 errs() <<
" " << Msg <<
": Ptr: ";
64 errs() <<
"\t<->" << *I <<
'\n';
71 errs() <<
" " << Msg <<
": " << *CallA <<
" <-> " << *CallB <<
'\n';
79 errs() <<
" " << AR <<
": " << *V1 <<
" <-> " << *V2 <<
'\n';
85 && !isa<ConstantPointerNull>(V);
103 for (
auto &
I : F.
args())
104 if (
I.getType()->isPointerTy())
108 if (
I->getType()->isPointerTy())
115 if (
auto *Call = dyn_cast<CallBase>(&Inst)) {
121 for (
Use &DataOp : Call->data_ops())
137 <<
" pointers, " << Calls.
size() <<
" call sites\n";
143 Type *I1ElTy = cast<PointerType>((*I1)->getType())->getElementType();
149 Type *I2ElTy = cast<PointerType>((*I2)->getType())->getElementType();
232 for (
auto Pointer : Pointers) {
234 Type *ElTy = cast<PointerType>(Pointer->getType())->getElementType();
329 errs() <<
"(" << Num * 100LL / Sum <<
"." << ((Num * 1000LL / Sum) % 10)
334 if (FunctionCount == 0)
338 NoAliasCount + MayAliasCount + PartialAliasCount + MustAliasCount;
339 errs() <<
"===== Alias Analysis Evaluator Report =====\n";
341 errs() <<
" Alias Analysis Evaluator Summary: No pointers!\n";
343 errs() <<
" " << AliasSum <<
" Total Alias Queries Performed\n";
344 errs() <<
" " << NoAliasCount <<
" no alias responses ";
346 errs() <<
" " << MayAliasCount <<
" may alias responses ";
348 errs() <<
" " << PartialAliasCount <<
" partial alias responses ";
350 errs() <<
" " << MustAliasCount <<
" must alias responses ";
352 errs() <<
" Alias Analysis Evaluator Pointer Alias Summary: " 353 << NoAliasCount * 100 / AliasSum <<
"%/" 354 << MayAliasCount * 100 / AliasSum <<
"%/" 355 << PartialAliasCount * 100 / AliasSum <<
"%/" 356 << MustAliasCount * 100 / AliasSum <<
"%\n";
360 int64_t ModRefSum = NoModRefCount + RefCount + ModCount + ModRefCount +
361 MustCount + MustRefCount + MustModCount + MustModRefCount;
362 if (ModRefSum == 0) {
363 errs() <<
" Alias Analysis Mod/Ref Evaluator Summary: no " 366 errs() <<
" " << ModRefSum <<
" Total ModRef Queries Performed\n";
367 errs() <<
" " << NoModRefCount <<
" no mod/ref responses ";
369 errs() <<
" " << ModCount <<
" mod responses ";
371 errs() <<
" " << RefCount <<
" ref responses ";
373 errs() <<
" " << ModRefCount <<
" mod & ref responses ";
375 errs() <<
" " << MustCount <<
" must responses ";
377 errs() <<
" " << MustModCount <<
" must mod responses ";
379 errs() <<
" " << MustRefCount <<
" must ref responses ";
381 errs() <<
" " << MustModRefCount <<
" must mod & ref responses ";
383 errs() <<
" Alias Analysis Evaluator Mod/Ref Summary: " 384 << NoModRefCount * 100 / ModRefSum <<
"%/" 385 << ModCount * 100 / ModRefSum <<
"%/" << RefCount * 100 / ModRefSum
386 <<
"%/" << ModRefCount * 100 / ModRefSum <<
"%/" 387 << MustCount * 100 / ModRefSum <<
"%/" 388 << MustRefCount * 100 / ModRefSum <<
"%/" 389 << MustModCount * 100 / ModRefSum <<
"%/" 390 << MustModRefCount * 100 / ModRefSum <<
"%\n";
396 std::unique_ptr<AAEvaluator>
P;
415 P->runInternal(F, getAnalysis<AAResultsWrapperPass>().getAAResults());
427 "Exhaustive Alias Analysis Precision Evaluator",
false,
The access may reference and may modify the value stored in memory.
static cl::opt< bool > PrintPartialAlias("print-partial-aliases", cl::ReallyHidden)
A parsed version of the target data layout string in and methods for querying it. ...
The access neither references nor modifies the value stored in memory.
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
This class represents lattice values for constants.
size_type size() const
Determine the number of elements in the SetVector.
A Module instance is used to store all the information related to an LLVM module. ...
bool isSized(SmallPtrSetImpl< Type *> *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
static constexpr LocationSize unknown()
void initializeAAEvalLegacyPassPass(PassRegistry &)
This file implements a simple N^2 alias analysis accuracy evaluator.
static void PrintModRefResults(const char *Msg, bool P, Instruction *I, Value *Ptr, Module *M)
static cl::opt< bool > PrintMod("print-mod", cl::ReallyHidden)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
The two locations do not alias at all.
static LocationSize precise(uint64_t Value)
static cl::opt< bool > PrintModRef("print-modref", cl::ReallyHidden)
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Run the pass over the function.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
FunctionPass * createAAEvalPass()
Create a wrapper of the above for the legacy pass manager.
block Block Frequency true
iterator end()
Get an iterator to the end of the SetVector.
static cl::opt< bool > PrintMustAlias("print-must-aliases", cl::ReallyHidden)
static void PrintResults(AliasResult AR, bool P, const Value *V1, const Value *V2, const Module *M)
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
The main low level interface to the alias analysis implementation.
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
inst_iterator inst_begin(Function *F)
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
A Use represents the edge between a Value definition and its users.
Must is provided for completeness, but no routines will return only Must today.
The access may reference the value stored in memory, a mustAlias relation was found, and no mayAlias or partialAlias found.
The access may reference the value stored in memory.
friend class AAEvalLegacyPass
bool doFinalization(Module &M) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
Type * getType() const
All values are typed, get the type of this value.
bool insert(const value_type &X)
Insert a new element into the SetVector.
The access may reference, modify or both the value stored in memory, a mustAlias relation was found...
The access may modify the value stored in memory, a mustAlias relation was found, and no mayAlias or ...
iterator begin()
Get an iterator to the beginning of the SetVector.
INITIALIZE_PASS_BEGIN(AAEvalLegacyPass, "aa-eval", "Exhaustive Alias Analysis Precision Evaluator", false, true) INITIALIZE_PASS_END(AAEvalLegacyPass
static bool isInterestingPointer(Value *V)
AliasResult
The possible results of an alias query.
static cl::opt< bool > PrintRef("print-ref", cl::ReallyHidden)
static MemoryLocation get(const LoadInst *LI)
Return a location with information about the memory reference by the given instruction.
A set of analyses that are preserved following a run of a transformation pass.
The instances of the Type class are immutable: once they are created, they are never changed...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static cl::opt< bool > PrintMayAlias("print-may-aliases", cl::ReallyHidden)
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool isPointerTy() const
True if this is an instance of PointerType.
A manager for alias analyses.
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass...
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
void printAsOperand(raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
Print the name of this Value out to the specified raw_ostream.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
The two locations may or may not alias. This is the least precise result.
This class evaluates LLVM IR, producing the Constant representing each SSA instruction.
The two locations precisely alias each other.
A SetVector that performs no allocations if smaller than a certain size.
Module.h This file contains the declarations for the Module class.
The access may modify the value stored in memory.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
amdgpu Simplify well known AMD library false FunctionCallee Callee
void setPreservesAll()
Set by analyses that do not transform their input at all.
static cl::opt< bool > PrintMust("print-must", cl::ReallyHidden)
static cl::opt< bool > PrintMustMod("print-mustmod", cl::ReallyHidden)
static void PrintPercent(int64_t Num, int64_t Sum)
static void PrintLoadStoreResults(AliasResult AR, bool P, const Value *V1, const Value *V2, const Module *M)
block Block Frequency Analysis
StringRef getName() const
Return a constant reference to the value's name.
static cl::opt< bool > EvalAAMD("evaluate-aa-metadata", cl::ReallyHidden)
static cl::opt< bool > PrintNoModRef("print-no-modref", cl::ReallyHidden)
A raw_ostream that writes to an std::string.
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
uint64_t getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
static cl::opt< bool > PrintMustRef("print-mustref", cl::ReallyHidden)
inst_iterator inst_end(Function *F)
A container for analyses that lazily runs them and caches their results.
static cl::opt< bool > PrintAll("print-all-alias-modref-info", cl::ReallyHidden)
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object...
ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc)
getModRefInfo (for call sites) - Return information about whether a particular call site modifies or ...
The two locations alias, but only due to a partial overlap.
static cl::opt< bool > PrintNoAlias("print-no-aliases", cl::ReallyHidden)
static cl::opt< bool > PrintMustModRef("print-mustmodref", cl::ReallyHidden)
iterator_range< arg_iterator > args()
bool doInitialization(Module &M) override
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...