36 std::pair<const Value *, Type *> Loc1,
37 std::pair<const Value *, Type *> Loc2,
40 Type *Ty1 = Loc1.second, *Ty2 = Loc2.second;
41 unsigned AS1 = Loc1.first->getType()->getPointerAddressSpace();
42 unsigned AS2 = Loc2.first->getType()->getPointerAddressSpace();
46 Loc1.first->printAsOperand(os1,
false, M);
47 Loc2.first->printAsOperand(os2,
false, M);
57 errs() <<
" " << AR <<
":\t";
60 errs() <<
" addrspace(" << AS1 <<
")";
61 errs() <<
"* " << o1 <<
", ";
62 Ty2->print(
errs(),
false,
true);
64 errs() <<
" addrspace(" << AS2 <<
")";
65 errs() <<
"* " << o2 <<
"\n";
71 std::pair<const Value *, Type *>
Loc,
Module *M) {
73 errs() <<
" " << Msg <<
": Ptr: ";
74 Loc.second->print(
errs(),
false,
true);
76 Loc.first->printAsOperand(
errs(),
false, M);
77 errs() <<
"\t<->" << *
I <<
'\n';
85 errs() <<
" " << Msg <<
": " << *MemOpA <<
" <-> " << *MemOpB <<
'\n';
93 errs() <<
" " << AR <<
": " << *V1 <<
" <-> " << *V2 <<
'\n';
114 Pointers.
insert({LI->getPointerOperand(), LI->getType()});
117 Pointers.
insert({
SI->getPointerOperand(),
118 SI->getValueOperand()->getType()});
123 OtherMemOps.
insert(&Inst);
128 errs() <<
"Function: " <<
F.getName() <<
": " << Pointers.
size()
129 <<
" pointers, " << OtherMemOps.
size() <<
" call sites\n";
132 for (
auto I1 = Pointers.
begin(),
E = Pointers.
end(); I1 !=
E; ++I1) {
134 for (
auto I2 = Pointers.
begin(); I2 != I1; ++I2) {
137 AliasResult AR = AA.
alias(
I1->first, Size1, I2->first, Size2);
161 for (
Value *Load : Loads) {
162 for (
Value *Store : Stores) {
215 for (Instruction *MemOp : OtherMemOps) {
216 for (
const auto &Pointer : Pointers) {
243 for (Instruction *MemOpA : OtherMemOps) {
244 for (Instruction *MemOpB : OtherMemOps) {
245 if (MemOpA == MemOpB)
272 errs() <<
"(" << Num * 100LL / Sum <<
"." << ((Num * 1000LL / Sum) % 10)
277 if (FunctionCount == 0)
281 NoAliasCount + MayAliasCount + PartialAliasCount + MustAliasCount;
282 errs() <<
"===== Alias Analysis Evaluator Report =====\n";
284 errs() <<
" Alias Analysis Evaluator Summary: No pointers!\n";
286 errs() <<
" " << AliasSum <<
" Total Alias Queries Performed\n";
287 errs() <<
" " << NoAliasCount <<
" no alias responses ";
289 errs() <<
" " << MayAliasCount <<
" may alias responses ";
291 errs() <<
" " << PartialAliasCount <<
" partial alias responses ";
293 errs() <<
" " << MustAliasCount <<
" must alias responses ";
295 errs() <<
" Alias Analysis Evaluator Pointer Alias Summary: "
296 << NoAliasCount * 100 / AliasSum <<
"%/"
297 << MayAliasCount * 100 / AliasSum <<
"%/"
298 << PartialAliasCount * 100 / AliasSum <<
"%/"
299 << MustAliasCount * 100 / AliasSum <<
"%\n";
303 int64_t ModRefSum = NoModRefCount + RefCount + ModCount + ModRefCount;
304 if (ModRefSum == 0) {
305 errs() <<
" Alias Analysis Mod/Ref Evaluator Summary: no "
308 errs() <<
" " << ModRefSum <<
" Total ModRef Queries Performed\n";
309 errs() <<
" " << NoModRefCount <<
" no mod/ref responses ";
311 errs() <<
" " << ModCount <<
" mod responses ";
313 errs() <<
" " << RefCount <<
" ref responses ";
315 errs() <<
" " << ModRefCount <<
" mod & ref responses ";
317 errs() <<
" Alias Analysis Evaluator Mod/Ref Summary: "
318 << NoModRefCount * 100 / ModRefSum <<
"%/"
319 << ModCount * 100 / ModRefSum <<
"%/" << RefCount * 100 / ModRefSum
320 <<
"%/" << ModRefCount * 100 / ModRefSum <<
"%\n";
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static void PrintModRefResults(const char *Msg, bool P, Instruction *I, std::pair< const Value *, Type * > Loc, Module *M)
static cl::opt< bool > PrintModRef("print-modref", cl::ReallyHidden)
static void PrintLoadStoreResults(AliasResult AR, bool P, const Value *V1, const Value *V2, const Module *M)
static void PrintPercent(int64_t Num, int64_t Sum)
static cl::opt< bool > EvalAAMD("evaluate-aa-metadata", cl::ReallyHidden)
static cl::opt< bool > PrintRef("print-ref", cl::ReallyHidden)
static cl::opt< bool > PrintNoAlias("print-no-aliases", cl::ReallyHidden)
static cl::opt< bool > PrintMayAlias("print-may-aliases", cl::ReallyHidden)
static cl::opt< bool > PrintMod("print-mod", cl::ReallyHidden)
static cl::opt< bool > PrintMustAlias("print-must-aliases", cl::ReallyHidden)
static cl::opt< bool > PrintAll("print-all-alias-modref-info", cl::ReallyHidden)
static cl::opt< bool > PrintNoModRef("print-no-modref", cl::ReallyHidden)
static cl::opt< bool > PrintPartialAlias("print-partial-aliases", cl::ReallyHidden)
This file implements a simple N^2 alias analysis accuracy evaluator.
static cl::opt< bool > PrintResults("print-debug-ata", cl::init(false), cl::Hidden)
Print the results of the analysis. Respects -filter-print-funcs.
Expand Atomic instructions
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Module.h This file contains the declarations for the Module class.
This file implements a set that has insertion order iteration characteristics.
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Run the pass over the function.
A manager for alias analyses.
ModRefInfo getModRefInfo(const Instruction *I, const std::optional< MemoryLocation > &OptLoc)
Check whether or not an instruction may read or write the optionally specified memory location.
LLVM_ABI AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
The main low level interface to the alias analysis implementation.
The possible results of an alias query.
void swap(bool DoSwap=true)
Helper for processing AliasResult for swapped memory location pairs.
@ MayAlias
The two locations may or may not alias.
@ NoAlias
The two locations do not alias at all.
@ PartialAlias
The two locations alias, but only due to a partial overlap.
@ 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.
A parsed version of the target data layout string in and methods for querying it.
static LocationSize precise(uint64_t Value)
static LLVM_ABI MemoryLocation get(const LoadInst *LI)
Return a location with information about the memory reference by the given instruction.
A Module instance is used to store all the information related to an LLVM module.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
A vector that has set insertion semantics.
size_type size() const
Determine the number of elements in the SetVector.
typename vector_type::const_iterator iterator
iterator end()
Get an iterator to the end of the SetVector.
iterator begin()
Get an iterator to the beginning of the SetVector.
bool insert(const value_type &X)
Insert a new element into the SetVector.
A SetVector that performs no allocations if smaller than a certain size.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM_ABI void print(raw_ostream &O, bool IsForDebug=false, bool NoDetails=false) const
Print the current type.
LLVM Value Representation.
A raw_ostream that writes to an std::string.
Abstract Attribute helper functions.
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
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...
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
@ Ref
The access may reference the value stored in memory.
@ ModRef
The access may reference and may modify the value stored in memory.
@ Mod
The access may modify the value stored in memory.
@ NoModRef
The access neither references nor modifies the value stored in memory.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.