56 errs() <<
" " << AR <<
":\t" << o1 <<
", " << o2 <<
"\n";
63 errs() <<
" " << Msg <<
": Ptr: ";
65 errs() <<
"\t<->" << *I <<
'\n';
72 errs() <<
" " << Msg <<
": " << *CallA <<
" <-> " << *CallB <<
'\n';
80 errs() <<
" " << AR <<
": " << *V1 <<
" <-> " << *V2 <<
'\n';
86 && !isa<ConstantPointerNull>(V);
104 for (
auto &
I : F.
args())
105 if (
I.getType()->isPointerTy())
109 if (
I->getType()->isPointerTy())
116 if (
auto *Call = dyn_cast<CallBase>(&Inst)) {
122 for (
Use &DataOp : Call->data_ops())
138 <<
" pointers, " << Calls.
size() <<
" call sites\n";
144 Type *I1ElTy = cast<PointerType>((*I1)->getType())->getElementType();
150 Type *I2ElTy = cast<PointerType>((*I2)->getType())->getElementType();
233 for (
auto Pointer : Pointers) {
235 Type *ElTy = cast<PointerType>(Pointer->getType())->getElementType();
330 errs() <<
"(" << Num * 100LL / Sum <<
"." << ((Num * 1000LL / Sum) % 10)
335 if (FunctionCount == 0)
339 NoAliasCount + MayAliasCount + PartialAliasCount + MustAliasCount;
340 errs() <<
"===== Alias Analysis Evaluator Report =====\n";
342 errs() <<
" Alias Analysis Evaluator Summary: No pointers!\n";
344 errs() <<
" " << AliasSum <<
" Total Alias Queries Performed\n";
345 errs() <<
" " << NoAliasCount <<
" no alias responses ";
347 errs() <<
" " << MayAliasCount <<
" may alias responses ";
349 errs() <<
" " << PartialAliasCount <<
" partial alias responses ";
351 errs() <<
" " << MustAliasCount <<
" must alias responses ";
353 errs() <<
" Alias Analysis Evaluator Pointer Alias Summary: " 354 << NoAliasCount * 100 / AliasSum <<
"%/" 355 << MayAliasCount * 100 / AliasSum <<
"%/" 356 << PartialAliasCount * 100 / AliasSum <<
"%/" 357 << MustAliasCount * 100 / AliasSum <<
"%\n";
361 int64_t ModRefSum = NoModRefCount + RefCount + ModCount + ModRefCount +
362 MustCount + MustRefCount + MustModCount + MustModRefCount;
363 if (ModRefSum == 0) {
364 errs() <<
" Alias Analysis Mod/Ref Evaluator Summary: no " 367 errs() <<
" " << ModRefSum <<
" Total ModRef Queries Performed\n";
368 errs() <<
" " << NoModRefCount <<
" no mod/ref responses ";
370 errs() <<
" " << ModCount <<
" mod responses ";
372 errs() <<
" " << RefCount <<
" ref responses ";
374 errs() <<
" " << ModRefCount <<
" mod & ref responses ";
376 errs() <<
" " << MustCount <<
" must responses ";
378 errs() <<
" " << MustModCount <<
" must mod responses ";
380 errs() <<
" " << MustRefCount <<
" must ref responses ";
382 errs() <<
" " << MustModRefCount <<
" must mod & ref responses ";
384 errs() <<
" Alias Analysis Evaluator Mod/Ref Summary: " 385 << NoModRefCount * 100 / ModRefSum <<
"%/" 386 << ModCount * 100 / ModRefSum <<
"%/" << RefCount * 100 / ModRefSum
387 <<
"%/" << ModRefCount * 100 / ModRefSum <<
"%/" 388 << MustCount * 100 / ModRefSum <<
"%/" 389 << MustRefCount * 100 / ModRefSum <<
"%/" 390 << MustModCount * 100 / ModRefSum <<
"%/" 391 << MustModRefCount * 100 / ModRefSum <<
"%\n";
397 std::unique_ptr<AAEvaluator>
P;
416 P->runInternal(F, getAnalysis<AAResultsWrapperPass>().getAAResults());
428 "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)
amdgpu Simplify well known AMD library false Value * Callee
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.
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 ...