52 errs() <<
" " << Msg <<
":\t"
62 errs() <<
" " << Msg <<
": Ptr: ";
64 errs() <<
"\t<->" << *I <<
'\n';
81 errs() <<
" " << Msg <<
": " << *V1
82 <<
" <-> " << *V2 <<
'\n';
88 && !isa<ConstantPointerNull>(V);
106 for (
auto &
I : F.
args())
107 if (
I.getType()->isPointerTy())
111 if (
I->getType()->isPointerTy())
119 Value *Callee = CS.getCalledValue();
124 for (
Use &DataOp : CS.data_ops())
140 <<
" pointers, " << CallSites.
size() <<
" call sites\n";
146 Type *I1ElTy = cast<PointerType>((*I1)->getType())->getElementType();
151 Type *I2ElTy =cast<PointerType>((*I2)->getType())->getElementType();
154 switch (AA.
alias(*I1, I1Size, *I2, I2Size)) {
241 for (
auto Pointer : Pointers) {
243 Type *ElTy = cast<PointerType>(
Pointer->getType())->getElementType();
270 for (
auto C = CallSites.begin(), Ce = CallSites.end();
C != Ce; ++
C) {
271 for (
auto D = CallSites.begin();
D != Ce; ++
D) {
297 errs() <<
"(" << Num * 100LL / Sum <<
"." << ((Num * 1000LL / Sum) % 10)
302 if (FunctionCount == 0)
306 NoAliasCount + MayAliasCount + PartialAliasCount + MustAliasCount;
307 errs() <<
"===== Alias Analysis Evaluator Report =====\n";
309 errs() <<
" Alias Analysis Evaluator Summary: No pointers!\n";
311 errs() <<
" " << AliasSum <<
" Total Alias Queries Performed\n";
312 errs() <<
" " << NoAliasCount <<
" no alias responses ";
314 errs() <<
" " << MayAliasCount <<
" may alias responses ";
316 errs() <<
" " << PartialAliasCount <<
" partial alias responses ";
318 errs() <<
" " << MustAliasCount <<
" must alias responses ";
320 errs() <<
" Alias Analysis Evaluator Pointer Alias Summary: "
321 << NoAliasCount * 100 / AliasSum <<
"%/"
322 << MayAliasCount * 100 / AliasSum <<
"%/"
323 << PartialAliasCount * 100 / AliasSum <<
"%/"
324 << MustAliasCount * 100 / AliasSum <<
"%\n";
328 int64_t ModRefSum = NoModRefCount + ModCount + RefCount + ModRefCount;
329 if (ModRefSum == 0) {
330 errs() <<
" Alias Analysis Mod/Ref Evaluator Summary: no "
333 errs() <<
" " << ModRefSum <<
" Total ModRef Queries Performed\n";
334 errs() <<
" " << NoModRefCount <<
" no mod/ref responses ";
336 errs() <<
" " << ModCount <<
" mod responses ";
338 errs() <<
" " << RefCount <<
" ref responses ";
340 errs() <<
" " << ModRefCount <<
" mod & ref responses ";
342 errs() <<
" Alias Analysis Evaluator Mod/Ref Summary: "
343 << NoModRefCount * 100 / ModRefSum <<
"%/"
344 << ModCount * 100 / ModRefSum <<
"%/" << RefCount * 100 / ModRefSum
345 <<
"%/" << ModRefCount * 100 / ModRefSum <<
"%\n";
351 std::unique_ptr<AAEvaluator> P;
370 P->runInternal(F, getAnalysis<AAResultsWrapperPass>().getAAResults());
382 "Exhaustive Alias Analysis Precision Evaluator",
false,
The two locations precisely alias each other.
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. ...
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...
INITIALIZE_PASS_BEGIN(AAEvalLegacyPass,"aa-eval","Exhaustive Alias Analysis Precision Evaluator", false, true) INITIALIZE_PASS_END(AAEvalLegacyPass
A Module instance is used to store all the information related to an LLVM module. ...
The two locations alias, but only due to a partial overlap.
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...
static cl::opt< bool > PrintModRef("print-modref", cl::ReallyHidden)
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Run the pass over the function.
The two locations do not alias at all.
FunctionPass * createAAEvalPass()
Create a wrapper of the above for the legacy pass manager.
iterator end()
Get an iterator to the end of the SetVector.
size_type size() const
Determine the number of elements in the SetVector.
The access modifies the value stored in memory.
The two locations may or may not alias. This is the least precise result.
aa Exhaustive Alias Analysis Precision false
static cl::opt< bool > PrintMustAlias("print-must-aliases", cl::ReallyHidden)
StringRef getName() const
Return a constant reference to the value's name.
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)
A Use represents the edge between a Value definition and its users.
static GCRegistry::Add< StatepointGC > D("statepoint-example","an example strategy for statepoint")
The access references the value stored in memory.
bool doFinalization(Module &M) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
bool insert(const value_type &X)
Insert a new element into the SetVector.
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.
iterator begin()
Get an iterator to the beginning of the SetVector.
static void PrintResults(const char *Msg, bool P, const Value *V1, const Value *V2, const Module *M)
static void PrintLoadStoreResults(const char *Msg, bool P, const Value *V1, const Value *V2, const Module *M)
static bool isInterestingPointer(Value *V)
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
static cl::opt< bool > PrintRef("print-ref", cl::ReallyHidden)
bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
The access neither references nor modifies the value stored in memory.
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.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs...ExtraArgs)
Get the result of an analysis pass for a given IR unit.
The instances of the Type class are immutable: once they are created, they are never changed...
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...
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.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE,"Assign register bank of generic virtual registers", false, false) RegBankSelect
FunctionPass class - This class is used to implement most global optimizations.
bool isPointerTy() const
True if this is an instance of PointerType.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
This class evaluates LLVM IR, producing the Constant representing each SSA instruction.
A SetVector that performs no allocations if smaller than a certain size.
InstrTy * getInstruction() const
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc)
getModRefInfo (for call sites) - Return information about whether a particular call site modifies or ...
void setPreservesAll()
Set by analyses that do not transform their input at all.
static void PrintPercent(int64_t Num, int64_t Sum)
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
block Block Frequency Analysis
static cl::opt< bool > EvalAAMD("evaluate-aa-metadata", cl::ReallyHidden)
The access both references and modifies the value stored in memory.
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 > 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.
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...
static cl::opt< bool > PrintNoAlias("print-no-aliases", cl::ReallyHidden)
iterator_range< arg_iterator > args()
bool doInitialization(Module &M) override
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...