LLVM  13.0.0git
AliasAnalysisEvaluator.cpp
Go to the documentation of this file.
1 //===- AliasAnalysisEvaluator.cpp - Alias Analysis Accuracy Evaluator -----===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "llvm/ADT/SetVector.h"
12 #include "llvm/IR/Constants.h"
13 #include "llvm/IR/DataLayout.h"
14 #include "llvm/IR/DerivedTypes.h"
15 #include "llvm/IR/Function.h"
16 #include "llvm/IR/InstIterator.h"
17 #include "llvm/IR/Instructions.h"
18 #include "llvm/IR/Module.h"
19 #include "llvm/InitializePasses.h"
20 #include "llvm/Pass.h"
22 #include "llvm/Support/Debug.h"
24 using namespace llvm;
25 
26 static cl::opt<bool> PrintAll("print-all-alias-modref-info", cl::ReallyHidden);
27 
28 static cl::opt<bool> PrintNoAlias("print-no-aliases", cl::ReallyHidden);
29 static cl::opt<bool> PrintMayAlias("print-may-aliases", cl::ReallyHidden);
30 static cl::opt<bool> PrintPartialAlias("print-partial-aliases", cl::ReallyHidden);
31 static cl::opt<bool> PrintMustAlias("print-must-aliases", cl::ReallyHidden);
32 
33 static cl::opt<bool> PrintNoModRef("print-no-modref", cl::ReallyHidden);
34 static cl::opt<bool> PrintRef("print-ref", cl::ReallyHidden);
35 static cl::opt<bool> PrintMod("print-mod", cl::ReallyHidden);
36 static cl::opt<bool> PrintModRef("print-modref", cl::ReallyHidden);
37 static cl::opt<bool> PrintMust("print-must", cl::ReallyHidden);
38 static cl::opt<bool> PrintMustRef("print-mustref", cl::ReallyHidden);
39 static cl::opt<bool> PrintMustMod("print-mustmod", cl::ReallyHidden);
40 static cl::opt<bool> PrintMustModRef("print-mustmodref", cl::ReallyHidden);
41 
42 static cl::opt<bool> EvalAAMD("evaluate-aa-metadata", cl::ReallyHidden);
43 
44 static void PrintResults(AliasResult AR, bool P, const Value *V1,
45  const Value *V2, const Module *M) {
46  if (PrintAll || P) {
47  std::string o1, o2;
48  {
49  raw_string_ostream os1(o1), os2(o2);
50  V1->printAsOperand(os1, true, M);
51  V2->printAsOperand(os2, true, M);
52  }
53 
54  if (o2 < o1) {
55  std::swap(o1, o2);
56  // Change offset sign for the local AR, for printing only.
57  AR.swap();
58  }
59  errs() << " " << AR << ":\t" << o1 << ", " << o2 << "\n";
60  }
61 }
62 
63 static inline void PrintModRefResults(const char *Msg, bool P, Instruction *I,
64  Value *Ptr, Module *M) {
65  if (PrintAll || P) {
66  errs() << " " << Msg << ": Ptr: ";
67  Ptr->printAsOperand(errs(), true, M);
68  errs() << "\t<->" << *I << '\n';
69  }
70 }
71 
72 static inline void PrintModRefResults(const char *Msg, bool P, CallBase *CallA,
73  CallBase *CallB, Module *M) {
74  if (PrintAll || P) {
75  errs() << " " << Msg << ": " << *CallA << " <-> " << *CallB << '\n';
76  }
77 }
78 
79 static inline void PrintLoadStoreResults(AliasResult AR, bool P,
80  const Value *V1, const Value *V2,
81  const Module *M) {
82  if (PrintAll || P) {
83  errs() << " " << AR << ": " << *V1 << " <-> " << *V2 << '\n';
84  }
85 }
86 
87 static inline bool isInterestingPointer(Value *V) {
88  return V->getType()->isPointerTy()
89  && !isa<ConstantPointerNull>(V);
90 }
91 
93  runInternal(F, AM.getResult<AAManager>(F));
94  return PreservedAnalyses::all();
95 }
96 
97 void AAEvaluator::runInternal(Function &F, AAResults &AA) {
98  const DataLayout &DL = F.getParent()->getDataLayout();
99 
100  ++FunctionCount;
101 
102  SetVector<Value *> Pointers;
104  SetVector<Value *> Loads;
105  SetVector<Value *> Stores;
106 
107  for (auto &I : F.args())
108  if (I.getType()->isPointerTy()) // Add all pointer arguments.
109  Pointers.insert(&I);
110 
111  for (Instruction &Inst : instructions(F)) {
112  if (Inst.getType()->isPointerTy()) // Add all pointer instructions.
113  Pointers.insert(&Inst);
114  if (EvalAAMD && isa<LoadInst>(&Inst))
115  Loads.insert(&Inst);
116  if (EvalAAMD && isa<StoreInst>(&Inst))
117  Stores.insert(&Inst);
118  if (auto *Call = dyn_cast<CallBase>(&Inst)) {
119  Value *Callee = Call->getCalledOperand();
120  // Skip actual functions for direct function calls.
121  if (!isa<Function>(Callee) && isInterestingPointer(Callee))
122  Pointers.insert(Callee);
123  // Consider formals.
124  for (Use &DataOp : Call->data_ops())
125  if (isInterestingPointer(DataOp))
126  Pointers.insert(DataOp);
127  Calls.insert(Call);
128  } else {
129  // Consider all operands.
130  for (Use &Op : Inst.operands())
132  Pointers.insert(Op);
133  }
134  }
135 
138  errs() << "Function: " << F.getName() << ": " << Pointers.size()
139  << " pointers, " << Calls.size() << " call sites\n";
140 
141  // iterate over the worklist, and run the full (n^2)/2 disambiguations
142  for (SetVector<Value *>::iterator I1 = Pointers.begin(), E = Pointers.end();
143  I1 != E; ++I1) {
144  auto I1Size = LocationSize::afterPointer();
145  Type *I1ElTy = cast<PointerType>((*I1)->getType())->getElementType();
146  if (I1ElTy->isSized())
147  I1Size = LocationSize::precise(DL.getTypeStoreSize(I1ElTy));
148 
149  for (SetVector<Value *>::iterator I2 = Pointers.begin(); I2 != I1; ++I2) {
150  auto I2Size = LocationSize::afterPointer();
151  Type *I2ElTy = cast<PointerType>((*I2)->getType())->getElementType();
152  if (I2ElTy->isSized())
153  I2Size = LocationSize::precise(DL.getTypeStoreSize(I2ElTy));
154 
155  AliasResult AR = AA.alias(*I1, I1Size, *I2, I2Size);
156  switch (AR) {
158  PrintResults(AR, PrintNoAlias, *I1, *I2, F.getParent());
159  ++NoAliasCount;
160  break;
162  PrintResults(AR, PrintMayAlias, *I1, *I2, F.getParent());
163  ++MayAliasCount;
164  break;
166  PrintResults(AR, PrintPartialAlias, *I1, *I2, F.getParent());
167  ++PartialAliasCount;
168  break;
170  PrintResults(AR, PrintMustAlias, *I1, *I2, F.getParent());
171  ++MustAliasCount;
172  break;
173  }
174  }
175  }
176 
177  if (EvalAAMD) {
178  // iterate over all pairs of load, store
179  for (Value *Load : Loads) {
180  for (Value *Store : Stores) {
181  AliasResult AR = AA.alias(MemoryLocation::get(cast<LoadInst>(Load)),
182  MemoryLocation::get(cast<StoreInst>(Store)));
183  switch (AR) {
185  PrintLoadStoreResults(AR, PrintNoAlias, Load, Store, F.getParent());
186  ++NoAliasCount;
187  break;
189  PrintLoadStoreResults(AR, PrintMayAlias, Load, Store, F.getParent());
190  ++MayAliasCount;
191  break;
193  PrintLoadStoreResults(AR, PrintPartialAlias, Load, Store, F.getParent());
194  ++PartialAliasCount;
195  break;
197  PrintLoadStoreResults(AR, PrintMustAlias, Load, Store, F.getParent());
198  ++MustAliasCount;
199  break;
200  }
201  }
202  }
203 
204  // iterate over all pairs of store, store
205  for (SetVector<Value *>::iterator I1 = Stores.begin(), E = Stores.end();
206  I1 != E; ++I1) {
207  for (SetVector<Value *>::iterator I2 = Stores.begin(); I2 != I1; ++I2) {
208  AliasResult AR = AA.alias(MemoryLocation::get(cast<StoreInst>(*I1)),
209  MemoryLocation::get(cast<StoreInst>(*I2)));
210  switch (AR) {
212  PrintLoadStoreResults(AR, PrintNoAlias, *I1, *I2, F.getParent());
213  ++NoAliasCount;
214  break;
216  PrintLoadStoreResults(AR, PrintMayAlias, *I1, *I2, F.getParent());
217  ++MayAliasCount;
218  break;
220  PrintLoadStoreResults(AR, PrintPartialAlias, *I1, *I2, F.getParent());
221  ++PartialAliasCount;
222  break;
224  PrintLoadStoreResults(AR, PrintMustAlias, *I1, *I2, F.getParent());
225  ++MustAliasCount;
226  break;
227  }
228  }
229  }
230  }
231 
232  // Mod/ref alias analysis: compare all pairs of calls and values
233  for (CallBase *Call : Calls) {
234  for (auto Pointer : Pointers) {
236  Type *ElTy = cast<PointerType>(Pointer->getType())->getElementType();
237  if (ElTy->isSized())
238  Size = LocationSize::precise(DL.getTypeStoreSize(ElTy));
239 
240  switch (AA.getModRefInfo(Call, Pointer, Size)) {
242  PrintModRefResults("NoModRef", PrintNoModRef, Call, Pointer,
243  F.getParent());
244  ++NoModRefCount;
245  break;
246  case ModRefInfo::Mod:
247  PrintModRefResults("Just Mod", PrintMod, Call, Pointer, F.getParent());
248  ++ModCount;
249  break;
250  case ModRefInfo::Ref:
251  PrintModRefResults("Just Ref", PrintRef, Call, Pointer, F.getParent());
252  ++RefCount;
253  break;
254  case ModRefInfo::ModRef:
255  PrintModRefResults("Both ModRef", PrintModRef, Call, Pointer,
256  F.getParent());
257  ++ModRefCount;
258  break;
259  case ModRefInfo::Must:
260  PrintModRefResults("Must", PrintMust, Call, Pointer, F.getParent());
261  ++MustCount;
262  break;
263  case ModRefInfo::MustMod:
264  PrintModRefResults("Just Mod (MustAlias)", PrintMustMod, Call, Pointer,
265  F.getParent());
266  ++MustModCount;
267  break;
268  case ModRefInfo::MustRef:
269  PrintModRefResults("Just Ref (MustAlias)", PrintMustRef, Call, Pointer,
270  F.getParent());
271  ++MustRefCount;
272  break;
274  PrintModRefResults("Both ModRef (MustAlias)", PrintMustModRef, Call,
275  Pointer, F.getParent());
276  ++MustModRefCount;
277  break;
278  }
279  }
280  }
281 
282  // Mod/ref alias analysis: compare all pairs of calls
283  for (CallBase *CallA : Calls) {
284  for (CallBase *CallB : Calls) {
285  if (CallA == CallB)
286  continue;
287  switch (AA.getModRefInfo(CallA, CallB)) {
289  PrintModRefResults("NoModRef", PrintNoModRef, CallA, CallB,
290  F.getParent());
291  ++NoModRefCount;
292  break;
293  case ModRefInfo::Mod:
294  PrintModRefResults("Just Mod", PrintMod, CallA, CallB, F.getParent());
295  ++ModCount;
296  break;
297  case ModRefInfo::Ref:
298  PrintModRefResults("Just Ref", PrintRef, CallA, CallB, F.getParent());
299  ++RefCount;
300  break;
301  case ModRefInfo::ModRef:
302  PrintModRefResults("Both ModRef", PrintModRef, CallA, CallB,
303  F.getParent());
304  ++ModRefCount;
305  break;
306  case ModRefInfo::Must:
307  PrintModRefResults("Must", PrintMust, CallA, CallB, F.getParent());
308  ++MustCount;
309  break;
310  case ModRefInfo::MustMod:
311  PrintModRefResults("Just Mod (MustAlias)", PrintMustMod, CallA, CallB,
312  F.getParent());
313  ++MustModCount;
314  break;
315  case ModRefInfo::MustRef:
316  PrintModRefResults("Just Ref (MustAlias)", PrintMustRef, CallA, CallB,
317  F.getParent());
318  ++MustRefCount;
319  break;
321  PrintModRefResults("Both ModRef (MustAlias)", PrintMustModRef, CallA,
322  CallB, F.getParent());
323  ++MustModRefCount;
324  break;
325  }
326  }
327  }
328 }
329 
330 static void PrintPercent(int64_t Num, int64_t Sum) {
331  errs() << "(" << Num * 100LL / Sum << "." << ((Num * 1000LL / Sum) % 10)
332  << "%)\n";
333 }
334 
336  if (FunctionCount == 0)
337  return;
338 
339  int64_t AliasSum =
340  NoAliasCount + MayAliasCount + PartialAliasCount + MustAliasCount;
341  errs() << "===== Alias Analysis Evaluator Report =====\n";
342  if (AliasSum == 0) {
343  errs() << " Alias Analysis Evaluator Summary: No pointers!\n";
344  } else {
345  errs() << " " << AliasSum << " Total Alias Queries Performed\n";
346  errs() << " " << NoAliasCount << " no alias responses ";
347  PrintPercent(NoAliasCount, AliasSum);
348  errs() << " " << MayAliasCount << " may alias responses ";
349  PrintPercent(MayAliasCount, AliasSum);
350  errs() << " " << PartialAliasCount << " partial alias responses ";
351  PrintPercent(PartialAliasCount, AliasSum);
352  errs() << " " << MustAliasCount << " must alias responses ";
353  PrintPercent(MustAliasCount, AliasSum);
354  errs() << " Alias Analysis Evaluator Pointer Alias Summary: "
355  << NoAliasCount * 100 / AliasSum << "%/"
356  << MayAliasCount * 100 / AliasSum << "%/"
357  << PartialAliasCount * 100 / AliasSum << "%/"
358  << MustAliasCount * 100 / AliasSum << "%\n";
359  }
360 
361  // Display the summary for mod/ref analysis
362  int64_t ModRefSum = NoModRefCount + RefCount + ModCount + ModRefCount +
363  MustCount + MustRefCount + MustModCount + MustModRefCount;
364  if (ModRefSum == 0) {
365  errs() << " Alias Analysis Mod/Ref Evaluator Summary: no "
366  "mod/ref!\n";
367  } else {
368  errs() << " " << ModRefSum << " Total ModRef Queries Performed\n";
369  errs() << " " << NoModRefCount << " no mod/ref responses ";
370  PrintPercent(NoModRefCount, ModRefSum);
371  errs() << " " << ModCount << " mod responses ";
372  PrintPercent(ModCount, ModRefSum);
373  errs() << " " << RefCount << " ref responses ";
374  PrintPercent(RefCount, ModRefSum);
375  errs() << " " << ModRefCount << " mod & ref responses ";
376  PrintPercent(ModRefCount, ModRefSum);
377  errs() << " " << MustCount << " must responses ";
378  PrintPercent(MustCount, ModRefSum);
379  errs() << " " << MustModCount << " must mod responses ";
380  PrintPercent(MustModCount, ModRefSum);
381  errs() << " " << MustRefCount << " must ref responses ";
382  PrintPercent(MustRefCount, ModRefSum);
383  errs() << " " << MustModRefCount << " must mod & ref responses ";
384  PrintPercent(MustModRefCount, ModRefSum);
385  errs() << " Alias Analysis Evaluator Mod/Ref Summary: "
386  << NoModRefCount * 100 / ModRefSum << "%/"
387  << ModCount * 100 / ModRefSum << "%/" << RefCount * 100 / ModRefSum
388  << "%/" << ModRefCount * 100 / ModRefSum << "%/"
389  << MustCount * 100 / ModRefSum << "%/"
390  << MustRefCount * 100 / ModRefSum << "%/"
391  << MustModCount * 100 / ModRefSum << "%/"
392  << MustModRefCount * 100 / ModRefSum << "%\n";
393  }
394 }
395 
396 namespace llvm {
398  std::unique_ptr<AAEvaluator> P;
399 
400 public:
401  static char ID; // Pass identification, replacement for typeid
404  }
405 
406  void getAnalysisUsage(AnalysisUsage &AU) const override {
408  AU.setPreservesAll();
409  }
410 
411  bool doInitialization(Module &M) override {
412  P.reset(new AAEvaluator());
413  return false;
414  }
415 
416  bool runOnFunction(Function &F) override {
417  P->runInternal(F, getAnalysis<AAResultsWrapperPass>().getAAResults());
418  return false;
419  }
420  bool doFinalization(Module &M) override {
421  P.reset();
422  return false;
423  }
424 };
425 }
426 
427 char AAEvalLegacyPass::ID = 0;
429  "Exhaustive Alias Analysis Precision Evaluator", false,
430  true)
433  "Exhaustive Alias Analysis Precision Evaluator", false,
434  true)
435 
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:155
llvm::ModRefInfo::NoModRef
@ NoModRef
The access neither references nor modifies the value stored in memory.
llvm::AAManager
A manager for alias analyses.
Definition: AliasAnalysis.h:1221
llvm::Type::isSized
bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
Definition: Type.h:272
llvm::AliasResult::MayAlias
@ MayAlias
The two locations may or may not alias.
Definition: AliasAnalysis.h:102
llvm::AliasResult::PartialAlias
@ PartialAlias
The two locations alias, but only due to a partial overlap.
Definition: AliasAnalysis.h:104
llvm::MemoryLocation::get
static MemoryLocation get(const LoadInst *LI)
Return a location with information about the memory reference by the given instruction.
Definition: MemoryLocation.cpp:37
llvm
Definition: AllocatorList.h:23
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:112
llvm::LocationSize::afterPointer
constexpr static LocationSize afterPointer()
Any location after the base pointer (but still within the underlying object).
Definition: MemoryLocation.h:123
llvm::Type::isPointerTy
bool isPointerTy() const
True if this is an instance of PointerType.
Definition: Type.h:229
llvm::AnalysisManager::getResult
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Definition: PassManager.h:785
InstIterator.h
aa
aa
Definition: AliasAnalysis.cpp:848
llvm::Function
Definition: Function.h:61
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
Pass.h
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:614
llvm::SetVector::size
size_type size() const
Determine the number of elements in the SetVector.
Definition: SetVector.h:77
llvm::AAEvalLegacyPass
Definition: AliasAnalysisEvaluator.cpp:397
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:46
Module.h
eval
aa eval
Definition: AliasAnalysisEvaluator.cpp:432
llvm::AliasResult
The possible results of an alias query.
Definition: AliasAnalysis.h:81
PrintMust
static cl::opt< bool > PrintMust("print-must", cl::ReallyHidden)
llvm::errs
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Definition: raw_ostream.cpp:892
PrintPercent
static void PrintPercent(int64_t Num, int64_t Sum)
Definition: AliasAnalysisEvaluator.cpp:330
PrintLoadStoreResults
static void PrintLoadStoreResults(AliasResult AR, bool P, const Value *V1, const Value *V2, const Module *M)
Definition: AliasAnalysisEvaluator.cpp:79
llvm::codeview::PointerMode::Pointer
@ Pointer
llvm::cl::ReallyHidden
@ ReallyHidden
Definition: CommandLine.h:141
INITIALIZE_PASS_END
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
Definition: RegBankSelect.cpp:69
llvm::ModRefInfo::Must
@ Must
Must is provided for completeness, but no routines will return only Must today.
F
#define F(x, y, z)
Definition: MD5.cpp:56
AliasAnalysis.h
llvm::AAEvalLegacyPass::runOnFunction
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
Definition: AliasAnalysisEvaluator.cpp:416
CommandLine.h
PrintMustMod
static cl::opt< bool > PrintMustMod("print-mustmod", cl::ReallyHidden)
llvm::ModRefInfo::MustRef
@ MustRef
The access may reference the value stored in memory, a mustAlias relation was found,...
llvm::createAAEvalPass
FunctionPass * createAAEvalPass()
Create a wrapper of the above for the legacy pass manager.
Definition: AliasAnalysisEvaluator.cpp:436
llvm::SetVector::begin
iterator begin()
Get an iterator to the beginning of the SetVector.
Definition: SetVector.h:82
llvm::PassRegistry::getPassRegistry
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Definition: PassRegistry.cpp:31
llvm::ModRefInfo::Ref
@ Ref
The access may reference the value stored in memory.
Constants.h
llvm::AAResults
Definition: AliasAnalysis.h:456
PrintNoModRef
static cl::opt< bool > PrintNoModRef("print-no-modref", cl::ReallyHidden)
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::ModRefInfo::MustModRef
@ MustModRef
The access may reference, modify or both the value stored in memory, a mustAlias relation was found,...
llvm::ModRefInfo::MustMod
@ MustMod
The access may modify the value stored in memory, a mustAlias relation was found, and no mayAlias or ...
llvm::AAEvalLegacyPass::getAnalysisUsage
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: AliasAnalysisEvaluator.cpp:406
EvalAAMD
static cl::opt< bool > EvalAAMD("evaluate-aa-metadata", cl::ReallyHidden)
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
PrintMustRef
static cl::opt< bool > PrintMustRef("print-mustref", cl::ReallyHidden)
false
Definition: StackSlotColoring.cpp:142
llvm::Instruction
Definition: Instruction.h:45
llvm::AAEvalLegacyPass::doFinalization
bool doFinalization(Module &M) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
Definition: AliasAnalysisEvaluator.cpp:420
llvm::LocationSize::precise
static LocationSize precise(uint64_t Value)
Definition: MemoryLocation.h:100
llvm::initializeAAEvalLegacyPassPass
void initializeAAEvalLegacyPassPass(PassRegistry &)
PrintPartialAlias
static cl::opt< bool > PrintPartialAlias("print-partial-aliases", cl::ReallyHidden)
PrintAll
static cl::opt< bool > PrintAll("print-all-alias-modref-info", cl::ReallyHidden)
llvm::AAEvalLegacyPass::ID
static char ID
Definition: AliasAnalysisEvaluator.cpp:401
llvm::cl::opt< bool >
PrintNoAlias
static cl::opt< bool > PrintNoAlias("print-no-aliases", cl::ReallyHidden)
PrintMustModRef
static cl::opt< bool > PrintMustModRef("print-mustmodref", cl::ReallyHidden)
llvm::instructions
inst_range instructions(Function *F)
Definition: InstIterator.h:133
llvm::AAEvalLegacyPass::AAEvalLegacyPass
AAEvalLegacyPass()
Definition: AliasAnalysisEvaluator.cpp:402
INITIALIZE_PASS_DEPENDENCY
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::Evaluator
This class evaluates LLVM IR, producing the Constant representing each SSA instruction.
Definition: Evaluator.h:38
llvm::AAEvalLegacyPass::doInitialization
bool doInitialization(Module &M) override
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
Definition: AliasAnalysisEvaluator.cpp:411
PrintMod
static cl::opt< bool > PrintMod("print-mod", cl::ReallyHidden)
PrintModRefResults
static void PrintModRefResults(const char *Msg, bool P, Instruction *I, Value *Ptr, Module *M)
Definition: AliasAnalysisEvaluator.cpp:63
std::swap
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition: BitVector.h:840
llvm::AAEvaluator::run
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Run the pass over the function.
Definition: AliasAnalysisEvaluator.cpp:92
PrintModRef
static cl::opt< bool > PrintModRef("print-modref", cl::ReallyHidden)
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::Value::printAsOperand
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.
Definition: AsmWriter.cpp:4691
llvm::SetVector::insert
bool insert(const value_type &X)
Insert a new element into the SetVector.
Definition: SetVector.h:141
llvm::AliasResult::swap
void swap(bool DoSwap=true)
Helper for processing AliasResult for swapped memory location pairs.
Definition: AliasAnalysis.h:130
llvm::SPII::Load
@ Load
Definition: SparcInstrInfo.h:32
DataLayout.h
llvm::Value::getType
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:256
PrintResults
static void PrintResults(AliasResult AR, bool P, const Value *V1, const Value *V2, const Module *M)
Definition: AliasAnalysisEvaluator.cpp:44
llvm::AliasResult::NoAlias
@ NoAlias
The two locations do not alias at all.
Definition: AliasAnalysis.h:99
llvm::ModRefInfo::Mod
@ Mod
The access may modify the value stored in memory.
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::AliasResult::MustAlias
@ MustAlias
The two locations precisely alias each other.
Definition: AliasAnalysis.h:106
llvm::AAEvaluator::~AAEvaluator
~AAEvaluator()
Definition: AliasAnalysisEvaluator.cpp:335
llvm::SPII::Store
@ Store
Definition: SparcInstrInfo.h:33
Callee
amdgpu Simplify well known AMD library false FunctionCallee Callee
Definition: AMDGPULibCalls.cpp:205
llvm::NVPTX::PTXLdStInstCode::V2
@ V2
Definition: NVPTX.h:123
PrintMustAlias
static cl::opt< bool > PrintMustAlias("print-must-aliases", cl::ReallyHidden)
llvm::AnalysisUsage::setPreservesAll
void setPreservesAll()
Set by analyses that do not transform their input at all.
Definition: PassAnalysisSupport.h:130
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:314
llvm::PreservedAnalyses::all
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: PassManager.h:161
Function.h
llvm::AAResults::alias
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
The main low level interface to the alias analysis implementation.
Definition: AliasAnalysis.cpp:118
llvm::SetVector::end
iterator end()
Get an iterator to the end of the SetVector.
Definition: SetVector.h:92
llvm::AAEvaluator
Definition: AliasAnalysisEvaluator.h:33
AliasAnalysisEvaluator.h
Instructions.h
isInterestingPointer
static bool isInterestingPointer(Value *V)
Definition: AliasAnalysisEvaluator.cpp:87
P
#define P(N)
llvm::AAResultsWrapperPass
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object.
Definition: AliasAnalysis.h:1269
PrintRef
static cl::opt< bool > PrintRef("print-ref", cl::ReallyHidden)
llvm::CallBase
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1164
DerivedTypes.h
llvm::SmallSetVector
A SetVector that performs no allocations if smaller than a certain size.
Definition: SetVector.h:307
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
llvm::FunctionPass
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:298
INITIALIZE_PASS_BEGIN
INITIALIZE_PASS_BEGIN(AAEvalLegacyPass, "aa-eval", "Exhaustive Alias Analysis Precision Evaluator", false, true) INITIALIZE_PASS_END(AAEvalLegacyPass
llvm::AnalysisUsage::addRequired
AnalysisUsage & addRequired()
Definition: PassAnalysisSupport.h:75
raw_ostream.h
PrintMayAlias
static cl::opt< bool > PrintMayAlias("print-may-aliases", cl::ReallyHidden)
llvm::SetVector< Value * >
true
basic Basic Alias true
Definition: BasicAliasAnalysis.cpp:1789
InitializePasses.h
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
Debug.h
llvm::AAResults::getModRefInfo
ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc)
getModRefInfo (for call sites) - Return information about whether a particular call site modifies or ...
Definition: AliasAnalysis.cpp:217
llvm::ModRefInfo::ModRef
@ ModRef
The access may reference and may modify the value stored in memory.
SetVector.h
llvm::Use
A Use represents the edge between a Value definition and its users.
Definition: Use.h:44