LLVM  14.0.0git
AliasSetTracker.h
Go to the documentation of this file.
1 //===- llvm/Analysis/AliasSetTracker.h - Build Alias Sets -------*- C++ -*-===//
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 //
9 // This file defines two classes: AliasSetTracker and AliasSet. These interfaces
10 // are used to classify a collection of pointer references into a maximal number
11 // of disjoint sets. Each AliasSet object constructed by the AliasSetTracker
12 // object refers to memory disjoint from the other sets.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_ANALYSIS_ALIASSETTRACKER_H
17 #define LLVM_ANALYSIS_ALIASSETTRACKER_H
18 
19 #include "llvm/ADT/DenseMap.h"
20 #include "llvm/ADT/DenseMapInfo.h"
21 #include "llvm/ADT/ilist.h"
22 #include "llvm/ADT/ilist_node.h"
24 #include "llvm/IR/Instruction.h"
25 #include "llvm/IR/Metadata.h"
26 #include "llvm/IR/PassManager.h"
27 #include "llvm/IR/ValueHandle.h"
28 #include "llvm/Support/Casting.h"
29 #include <cassert>
30 #include <cstddef>
31 #include <cstdint>
32 #include <iterator>
33 #include <vector>
34 
35 namespace llvm {
36 
37 class AAResults;
38 class AliasResult;
39 class AliasSetTracker;
40 class AnyMemSetInst;
41 class AnyMemTransferInst;
42 class BasicBlock;
43 class LoadInst;
44 class raw_ostream;
45 class StoreInst;
46 class VAArgInst;
47 class Value;
48 
49 class AliasSet : public ilist_node<AliasSet> {
50  friend class AliasSetTracker;
51 
52  class PointerRec {
53  Value *Val; // The pointer this record corresponds to.
54  PointerRec **PrevInList = nullptr;
55  PointerRec *NextInList = nullptr;
56  AliasSet *AS = nullptr;
58  AAMDNodes AAInfo;
59 
60  // Whether the size for this record has been set at all. This makes no
61  // guarantees about the size being known.
62  bool isSizeSet() const { return Size != LocationSize::mapEmpty(); }
63 
64  public:
65  PointerRec(Value *V)
66  : Val(V), AAInfo(DenseMapInfo<AAMDNodes>::getEmptyKey()) {}
67 
68  Value *getValue() const { return Val; }
69 
70  PointerRec *getNext() const { return NextInList; }
71  bool hasAliasSet() const { return AS != nullptr; }
72 
73  PointerRec** setPrevInList(PointerRec **PIL) {
74  PrevInList = PIL;
75  return &NextInList;
76  }
77 
78  bool updateSizeAndAAInfo(LocationSize NewSize, const AAMDNodes &NewAAInfo) {
79  bool SizeChanged = false;
80  if (NewSize != Size) {
81  LocationSize OldSize = Size;
82  Size = isSizeSet() ? Size.unionWith(NewSize) : NewSize;
83  SizeChanged = OldSize != Size;
84  }
85 
87  // We don't have a AAInfo yet. Set it to NewAAInfo.
88  AAInfo = NewAAInfo;
89  else {
90  AAMDNodes Intersection(AAInfo.intersect(NewAAInfo));
91  SizeChanged |= Intersection != AAInfo;
92  AAInfo = Intersection;
93  }
94  return SizeChanged;
95  }
96 
97  LocationSize getSize() const {
98  assert(isSizeSet() && "Getting an unset size!");
99  return Size;
100  }
101 
102  /// Return the AAInfo, or null if there is no information or conflicting
103  /// information.
104  AAMDNodes getAAInfo() const {
105  // If we have missing or conflicting AAInfo, return null.
106  if (AAInfo == DenseMapInfo<AAMDNodes>::getEmptyKey() ||
108  return AAMDNodes();
109  return AAInfo;
110  }
111 
112  AliasSet *getAliasSet(AliasSetTracker &AST) {
113  assert(AS && "No AliasSet yet!");
114  if (AS->Forward) {
115  AliasSet *OldAS = AS;
116  AS = OldAS->getForwardedTarget(AST);
117  AS->addRef();
118  OldAS->dropRef(AST);
119  }
120  return AS;
121  }
122 
123  void setAliasSet(AliasSet *as) {
124  assert(!AS && "Already have an alias set!");
125  AS = as;
126  }
127 
128  void eraseFromList() {
129  if (NextInList) NextInList->PrevInList = PrevInList;
130  *PrevInList = NextInList;
131  if (AS->PtrListEnd == &NextInList) {
132  AS->PtrListEnd = PrevInList;
133  assert(*AS->PtrListEnd == nullptr && "List not terminated right!");
134  }
135  delete this;
136  }
137  };
138 
139  // Doubly linked list of nodes.
140  PointerRec *PtrList = nullptr;
141  PointerRec **PtrListEnd;
142  // Forwarding pointer.
143  AliasSet *Forward = nullptr;
144 
145  /// All instructions without a specific address in this alias set.
146  /// In rare cases this vector can have a null'ed out WeakVH
147  /// instances (can happen if some other loop pass deletes an
148  /// instruction in this list).
149  std::vector<WeakVH> UnknownInsts;
150 
151  /// Number of nodes pointing to this AliasSet plus the number of AliasSets
152  /// forwarding to it.
153  unsigned RefCount : 27;
154 
155  // Signifies that this set should be considered to alias any pointer.
156  // Use when the tracker holding this set is saturated.
157  unsigned AliasAny : 1;
158 
159  /// The kinds of access this alias set models.
160  ///
161  /// We keep track of whether this alias set merely refers to the locations of
162  /// memory (and not any particular access), whether it modifies or references
163  /// the memory, or whether it does both. The lattice goes from "NoAccess" to
164  /// either RefAccess or ModAccess, then to ModRefAccess as necessary.
165  enum AccessLattice {
166  NoAccess = 0,
167  RefAccess = 1,
168  ModAccess = 2,
169  ModRefAccess = RefAccess | ModAccess
170  };
171  unsigned Access : 2;
172 
173  /// The kind of alias relationship between pointers of the set.
174  ///
175  /// These represent conservatively correct alias results between any members
176  /// of the set. We represent these independently of the values of alias
177  /// results in order to pack it into a single bit. Lattice goes from
178  /// MustAlias to MayAlias.
179  enum AliasLattice {
180  SetMustAlias = 0, SetMayAlias = 1
181  };
182  unsigned Alias : 1;
183 
184  unsigned SetSize = 0;
185 
186  void addRef() { ++RefCount; }
187 
188  void dropRef(AliasSetTracker &AST) {
189  assert(RefCount >= 1 && "Invalid reference count detected!");
190  if (--RefCount == 0)
191  removeFromTracker(AST);
192  }
193 
194  Instruction *getUnknownInst(unsigned i) const {
195  assert(i < UnknownInsts.size());
196  return cast_or_null<Instruction>(UnknownInsts[i]);
197  }
198 
199 public:
200  AliasSet(const AliasSet &) = delete;
201  AliasSet &operator=(const AliasSet &) = delete;
202 
203  /// Accessors...
204  bool isRef() const { return Access & RefAccess; }
205  bool isMod() const { return Access & ModAccess; }
206  bool isMustAlias() const { return Alias == SetMustAlias; }
207  bool isMayAlias() const { return Alias == SetMayAlias; }
208 
209  /// Return true if this alias set should be ignored as part of the
210  /// AliasSetTracker object.
211  bool isForwardingAliasSet() const { return Forward; }
212 
213  /// Merge the specified alias set into this alias set.
214  void mergeSetIn(AliasSet &AS, AliasSetTracker &AST);
215 
216  // Alias Set iteration - Allow access to all of the pointers which are part of
217  // this alias set.
218  class iterator;
219  iterator begin() const { return iterator(PtrList); }
220  iterator end() const { return iterator(); }
221  bool empty() const { return PtrList == nullptr; }
222 
223  // Unfortunately, ilist::size() is linear, so we have to add code to keep
224  // track of the list's exact size.
225  unsigned size() { return SetSize; }
226 
227  /// If this alias set is known to contain a single instruction and *only* a
228  /// single unique instruction, return it. Otherwise, return nullptr.
230 
231  void print(raw_ostream &OS) const;
232  void dump() const;
233 
234  /// Define an iterator for alias sets... this is just a forward iterator.
235  class iterator {
236  PointerRec *CurNode;
237 
238  public:
239  using iterator_category = std::forward_iterator_tag;
240  using value_type = PointerRec;
241  using difference_type = std::ptrdiff_t;
242  using pointer = value_type *;
244 
245  explicit iterator(PointerRec *CN = nullptr) : CurNode(CN) {}
246 
247  bool operator==(const iterator& x) const {
248  return CurNode == x.CurNode;
249  }
250  bool operator!=(const iterator& x) const { return !operator==(x); }
251 
253  assert(CurNode && "Dereferencing AliasSet.end()!");
254  return *CurNode;
255  }
256  value_type *operator->() const { return &operator*(); }
257 
258  Value *getPointer() const { return CurNode->getValue(); }
259  LocationSize getSize() const { return CurNode->getSize(); }
260  AAMDNodes getAAInfo() const { return CurNode->getAAInfo(); }
261 
262  iterator& operator++() { // Preincrement
263  assert(CurNode && "Advancing past AliasSet.end()!");
264  CurNode = CurNode->getNext();
265  return *this;
266  }
267  iterator operator++(int) { // Postincrement
268  iterator tmp = *this; ++*this; return tmp;
269  }
270  };
271 
272 private:
273  // Can only be created by AliasSetTracker.
274  AliasSet()
275  : PtrListEnd(&PtrList), RefCount(0), AliasAny(false), Access(NoAccess),
276  Alias(SetMustAlias) {}
277 
278  PointerRec *getSomePointer() const {
279  return PtrList;
280  }
281 
282  /// Return the real alias set this represents. If this has been merged with
283  /// another set and is forwarding, return the ultimate destination set. This
284  /// also implements the union-find collapsing as well.
285  AliasSet *getForwardedTarget(AliasSetTracker &AST) {
286  if (!Forward) return this;
287 
288  AliasSet *Dest = Forward->getForwardedTarget(AST);
289  if (Dest != Forward) {
290  Dest->addRef();
291  Forward->dropRef(AST);
292  Forward = Dest;
293  }
294  return Dest;
295  }
296 
297  void removeFromTracker(AliasSetTracker &AST);
298 
299  void addPointer(AliasSetTracker &AST, PointerRec &Entry, LocationSize Size,
300  const AAMDNodes &AAInfo, bool KnownMustAlias = false,
301  bool SkipSizeUpdate = false);
302  void addUnknownInst(Instruction *I, AAResults &AA);
303 
304  void removeUnknownInst(AliasSetTracker &AST, Instruction *I) {
305  bool WasEmpty = UnknownInsts.empty();
306  for (size_t i = 0, e = UnknownInsts.size(); i != e; ++i)
307  if (UnknownInsts[i] == I) {
308  UnknownInsts[i] = UnknownInsts.back();
309  UnknownInsts.pop_back();
310  --i; --e; // Revisit the moved entry.
311  }
312  if (!WasEmpty && UnknownInsts.empty())
313  dropRef(AST);
314  }
315 
316 public:
317  /// If the specified pointer "may" (or must) alias one of the members in the
318  /// set return the appropriate AliasResult. Otherwise return NoAlias.
319  AliasResult aliasesPointer(const Value *Ptr, LocationSize Size,
320  const AAMDNodes &AAInfo, AAResults &AA) const;
321  bool aliasesUnknownInst(const Instruction *Inst, AAResults &AA) const;
322 };
323 
324 inline raw_ostream& operator<<(raw_ostream &OS, const AliasSet &AS) {
325  AS.print(OS);
326  return OS;
327 }
328 
330  /// A CallbackVH to arrange for AliasSetTracker to be notified whenever a
331  /// Value is deleted.
332  class ASTCallbackVH final : public CallbackVH {
333  AliasSetTracker *AST;
334 
335  void deleted() override;
336  void allUsesReplacedWith(Value *) override;
337 
338  public:
339  ASTCallbackVH(Value *V, AliasSetTracker *AST = nullptr);
340 
341  ASTCallbackVH &operator=(Value *V);
342  };
343  /// Traits to tell DenseMap that tell us how to compare and hash the value
344  /// handle.
345  struct ASTCallbackVHDenseMapInfo : public DenseMapInfo<Value *> {};
346 
347  AAResults &AA;
348  ilist<AliasSet> AliasSets;
349 
350  using PointerMapType = DenseMap<ASTCallbackVH, AliasSet::PointerRec *,
351  ASTCallbackVHDenseMapInfo>;
352 
353  // Map from pointers to their node
354  PointerMapType PointerMap;
355 
356 public:
357  /// Create an empty collection of AliasSets, and use the specified alias
358  /// analysis object to disambiguate load and store addresses.
359  explicit AliasSetTracker(AAResults &AA) : AA(AA) {}
361 
362  /// These methods are used to add different types of instructions to the alias
363  /// sets. Adding a new instruction can result in one of three actions
364  /// happening:
365  ///
366  /// 1. If the instruction doesn't alias any other sets, create a new set.
367  /// 2. If the instruction aliases exactly one set, add it to the set
368  /// 3. If the instruction aliases multiple sets, merge the sets, and add
369  /// the instruction to the result.
370  ///
371  /// These methods return true if inserting the instruction resulted in the
372  /// addition of a new alias set (i.e., the pointer did not alias anything).
373  ///
374  void add(Value *Ptr, LocationSize Size, const AAMDNodes &AAInfo); // Add a loc
375  void add(LoadInst *LI);
376  void add(StoreInst *SI);
377  void add(VAArgInst *VAAI);
378  void add(AnyMemSetInst *MSI);
379  void add(AnyMemTransferInst *MTI);
380  void add(Instruction *I); // Dispatch to one of the other add methods...
381  void add(BasicBlock &BB); // Add all instructions in basic block
382  void add(const AliasSetTracker &AST); // Add alias relations from another AST
383  void addUnknown(Instruction *I);
384 
385  void clear();
386 
387  /// Return the alias sets that are active.
388  const ilist<AliasSet> &getAliasSets() const { return AliasSets; }
389 
390  /// Return the alias set which contains the specified memory location. If
391  /// the memory location aliases two or more existing alias sets, will have
392  /// the effect of merging those alias sets before the single resulting alias
393  /// set is returned.
394  AliasSet &getAliasSetFor(const MemoryLocation &MemLoc);
395 
396  /// Return the underlying alias analysis object used by this tracker.
397  AAResults &getAliasAnalysis() const { return AA; }
398 
399  /// This method is used to remove a pointer value from the AliasSetTracker
400  /// entirely. It should be used when an instruction is deleted from the
401  /// program to update the AST. If you don't use this, you would have dangling
402  /// pointers to deleted instructions.
403  void deleteValue(Value *PtrVal);
404 
405  /// This method should be used whenever a preexisting value in the program is
406  /// copied or cloned, introducing a new value. Note that it is ok for clients
407  /// that use this method to introduce the same value multiple times: if the
408  /// tracker already knows about a value, it will ignore the request.
409  void copyValue(Value *From, Value *To);
410 
413 
414  const_iterator begin() const { return AliasSets.begin(); }
415  const_iterator end() const { return AliasSets.end(); }
416 
417  iterator begin() { return AliasSets.begin(); }
418  iterator end() { return AliasSets.end(); }
419 
420  void print(raw_ostream &OS) const;
421  void dump() const;
422 
423 private:
424  friend class AliasSet;
425 
426  // The total number of pointers contained in all "may" alias sets.
427  unsigned TotalMayAliasSetSize = 0;
428 
429  // A non-null value signifies this AST is saturated. A saturated AST lumps
430  // all pointers into a single "May" set.
431  AliasSet *AliasAnyAS = nullptr;
432 
433  void removeAliasSet(AliasSet *AS);
434 
435  /// Just like operator[] on the map, except that it creates an entry for the
436  /// pointer if it doesn't already exist.
437  AliasSet::PointerRec &getEntryFor(Value *V) {
438  AliasSet::PointerRec *&Entry = PointerMap[ASTCallbackVH(V, this)];
439  if (!Entry)
440  Entry = new AliasSet::PointerRec(V);
441  return *Entry;
442  }
443 
444  AliasSet &addPointer(MemoryLocation Loc, AliasSet::AccessLattice E);
445  AliasSet *mergeAliasSetsForPointer(const Value *Ptr, LocationSize Size,
446  const AAMDNodes &AAInfo,
447  bool &MustAliasAll);
448 
449  /// Merge all alias sets into a single set that is considered to alias any
450  /// pointer.
451  AliasSet &mergeAllAliasSets();
452 
453  AliasSet *findAliasSetForUnknownInst(Instruction *Inst);
454 };
455 
457  AST.print(OS);
458  return OS;
459 }
460 
461 class AliasSetsPrinterPass : public PassInfoMixin<AliasSetsPrinterPass> {
462  raw_ostream &OS;
463 
464 public:
465  explicit AliasSetsPrinterPass(raw_ostream &OS);
467 };
468 
469 } // end namespace llvm
470 
471 #endif // LLVM_ANALYSIS_ALIASSETTRACKER_H
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
i
i
Definition: README.txt:29
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:155
llvm::AliasSetTracker::addUnknown
void addUnknown(Instruction *I)
Definition: AliasSetTracker.cpp:427
as
compiles conv shl5 shl ret i32 or10 it would be better as
Definition: README.txt:615
llvm::AliasSetTracker::~AliasSetTracker
~AliasSetTracker()
Definition: AliasSetTracker.h:360
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::VAArgInst
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
Definition: Instructions.h:1833
llvm::AliasSetTracker::end
const_iterator end() const
Definition: AliasSetTracker.h:415
Metadata.h
llvm::AliasSetTracker::getAliasSets
const ilist< AliasSet > & getAliasSets() const
Return the alias sets that are active.
Definition: AliasSetTracker.h:388
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:374
llvm::Function
Definition: Function.h:61
llvm::AliasSet::AliasSet
AliasSet(const AliasSet &)=delete
ilist.h
llvm::AliasSet::isMod
bool isMod() const
Definition: AliasSetTracker.h:205
llvm::AliasSet::iterator::iterator
iterator(PointerRec *CN=nullptr)
Definition: AliasSetTracker.h:245
llvm::AliasSetTracker::print
void print(raw_ostream &OS) const
Definition: AliasSetTracker.cpp:687
llvm::AliasSetTracker
Definition: AliasSetTracker.h:329
llvm::AliasSet::iterator::getSize
LocationSize getSize() const
Definition: AliasSetTracker.h:259
llvm::AAMDNodes
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
Definition: Metadata.h:651
llvm::AliasSet::iterator::difference_type
std::ptrdiff_t difference_type
Definition: AliasSetTracker.h:241
DenseMap.h
llvm::AliasSetTracker::end
iterator end()
Definition: AliasSetTracker.h:418
llvm::AliasSet::isRef
bool isRef() const
Accessors...
Definition: AliasSetTracker.h:204
tmp
alloca< 16 x float >, align 16 %tmp2=alloca< 16 x float >, align 16 store< 16 x float > %A,< 16 x float > *%tmp %s=bitcast< 16 x float > *%tmp to i8 *%s2=bitcast< 16 x float > *%tmp2 to i8 *call void @llvm.memcpy.i64(i8 *%s, i8 *%s2, i64 64, i32 16) %R=load< 16 x float > *%tmp2 ret< 16 x float > %R } declare void @llvm.memcpy.i64(i8 *nocapture, i8 *nocapture, i64, i32) nounwind which compiles to:_foo:subl $140, %esp movaps %xmm3, 112(%esp) movaps %xmm2, 96(%esp) movaps %xmm1, 80(%esp) movaps %xmm0, 64(%esp) movl 60(%esp), %eax movl %eax, 124(%esp) movl 56(%esp), %eax movl %eax, 120(%esp) movl 52(%esp), %eax< many many more 32-bit copies > movaps(%esp), %xmm0 movaps 16(%esp), %xmm1 movaps 32(%esp), %xmm2 movaps 48(%esp), %xmm3 addl $140, %esp ret On Nehalem, it may even be cheaper to just use movups when unaligned than to fall back to lower-granularity chunks. Implement processor-specific optimizations for parity with GCC on these processors. GCC does two optimizations:1. ix86_pad_returns inserts a noop before ret instructions if immediately preceded by a conditional branch or is the target of a jump. 2. ix86_avoid_jump_misspredicts inserts noops in cases where a 16-byte block of code contains more than 3 branches. The first one is done for all AMDs, Core2, and "Generic" The second one is done for:Atom, Pentium Pro, all AMDs, Pentium 4, Nocona, Core 2, and "Generic" Testcase:int x(int a) { return(a &0xf0)> >4 tmp
Definition: README.txt:1347
llvm::AliasSet::print
void print(raw_ostream &OS) const
Definition: AliasSetTracker.cpp:646
llvm::iplist
An intrusive list with ownership and callbacks specified/controlled by ilist_traits,...
Definition: ilist.h:390
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
llvm::AliasSetTracker::clear
void clear()
Definition: AliasSetTracker.cpp:286
llvm::AliasSet::iterator::operator*
value_type & operator*() const
Definition: AliasSetTracker.h:252
Instruction.h
llvm::AliasSet::end
iterator end() const
Definition: AliasSetTracker.h:220
llvm::DenseMapInfo
Definition: APInt.h:34
llvm::AliasSet::iterator::iterator_category
std::forward_iterator_tag iterator_category
Definition: AliasSetTracker.h:239
llvm::AliasSet::iterator::pointer
value_type * pointer
Definition: AliasSetTracker.h:242
llvm::AliasSet::iterator::reference
value_type & reference
Definition: AliasSetTracker.h:243
llvm::AAResults
Definition: AliasAnalysis.h:456
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::LocationSize
Definition: MemoryLocation.h:65
llvm::AliasSetTracker::dump
void dump() const
Definition: AliasSetTracker.cpp:699
llvm::AliasSetsPrinterPass
Definition: AliasSetTracker.h:461
llvm::AliasSet
Definition: AliasSetTracker.h:49
llvm::AliasSet::iterator::operator!=
bool operator!=(const iterator &x) const
Definition: AliasSetTracker.h:250
false
Definition: StackSlotColoring.cpp:142
llvm::AliasSet::isForwardingAliasSet
bool isForwardingAliasSet() const
Return true if this alias set should be ignored as part of the AliasSetTracker object.
Definition: AliasSetTracker.h:211
llvm::AliasSetsPrinterPass::run
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Definition: AliasSetTracker.cpp:766
llvm::Instruction
Definition: Instruction.h:45
llvm::AliasSet::iterator::getPointer
Value * getPointer() const
Definition: AliasSetTracker.h:258
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::operator<<
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:230
llvm::AliasSet::empty
bool empty() const
Definition: AliasSetTracker.h:221
llvm::AliasSet::iterator::getAAInfo
AAMDNodes getAAInfo() const
Definition: AliasSetTracker.h:260
llvm::AliasSet::mergeSetIn
void mergeSetIn(AliasSet &AS, AliasSetTracker &AST)
Merge the specified alias set into this alias set.
Definition: AliasSetTracker.cpp:48
llvm::AnyMemTransferInst
Definition: IntrinsicInst.h:1029
llvm::AliasSet::operator=
AliasSet & operator=(const AliasSet &)=delete
llvm::StoreInst
An instruction for storing to memory.
Definition: Instructions.h:304
llvm::AliasSetTracker::add
void add(Value *Ptr, LocationSize Size, const AAMDNodes &AAInfo)
These methods are used to add different types of instructions to the alias sets.
Definition: AliasSetTracker.cpp:397
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
MemoryLocation.h
llvm::DenseMap< ASTCallbackVH, AliasSet::PointerRec *, ASTCallbackVHDenseMapInfo >
llvm::AliasSet::size
unsigned size()
Definition: AliasSetTracker.h:225
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::AliasSet::isMayAlias
bool isMayAlias() const
Definition: AliasSetTracker.h:207
llvm::AliasSet::dump
void dump() const
Definition: AliasSetTracker.cpp:698
llvm::AliasSetTracker::getAliasAnalysis
AAResults & getAliasAnalysis() const
Return the underlying alias analysis object used by this tracker.
Definition: AliasSetTracker.h:397
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::AliasSet::iterator::operator==
bool operator==(const iterator &x) const
Definition: AliasSetTracker.h:247
SI
StandardInstrumentations SI(Debug, VerifyEach)
llvm::AliasSetsPrinterPass::AliasSetsPrinterPass
AliasSetsPrinterPass(raw_ostream &OS)
Definition: AliasSetTracker.cpp:764
llvm::AAMDNodes::intersect
AAMDNodes intersect(const AAMDNodes &Other) const
Given two sets of AAMDNodes that apply to the same pointer, give the best AAMDNodes that are compatib...
Definition: Metadata.h:690
llvm::AliasSetTracker::getAliasSetFor
AliasSet & getAliasSetFor(const MemoryLocation &MemLoc)
Return the alias set which contains the specified memory location.
Definition: AliasSetTracker.cpp:346
llvm::ISD::BasicBlock
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:71
llvm::AliasSet::iterator
Define an iterator for alias sets... this is just a forward iterator.
Definition: AliasSetTracker.h:235
llvm::AliasSet::aliasesPointer
AliasResult aliasesPointer(const Value *Ptr, LocationSize Size, const AAMDNodes &AAInfo, AAResults &AA) const
If the specified pointer "may" (or must) alias one of the members in the set return the appropriate A...
Definition: AliasSetTracker.cpp:194
llvm::AliasSetTracker::copyValue
void copyValue(Value *From, Value *To)
This method should be used whenever a preexisting value in the program is copied or cloned,...
Definition: AliasSetTracker.cpp:573
llvm::LocationSize::mapEmpty
constexpr static LocationSize mapEmpty()
Definition: MemoryLocation.h:137
llvm::DenseMapInfo< AAMDNodes >::getTombstoneKey
static AAMDNodes getTombstoneKey()
Definition: Metadata.h:724
llvm::LoadInst
An instruction for reading from memory.
Definition: Instructions.h:175
ValueHandle.h
llvm::AliasSetTracker::deleteValue
void deleteValue(Value *PtrVal)
This method is used to remove a pointer value from the AliasSetTracker entirely.
Definition: AliasSetTracker.cpp:545
llvm::ilist_node
Definition: ilist_node.h:148
llvm::AliasSet::iterator::operator++
iterator operator++(int)
Definition: AliasSetTracker.h:267
llvm::DenseMapInfo< AAMDNodes >::getEmptyKey
static AAMDNodes getEmptyKey()
Definition: Metadata.h:719
llvm::AnyMemSetInst
This class represents any memset intrinsic.
Definition: IntrinsicInst.h:1010
llvm::ilist_iterator
Iterator for intrusive lists based on ilist_node.
Definition: ilist_iterator.h:57
Casting.h
llvm::AliasSet::iterator::operator++
iterator & operator++()
Definition: AliasSetTracker.h:262
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
PassManager.h
x
TODO unsigned x
Definition: README.txt:10
llvm::CallbackVH
Value handle with callbacks on RAUW and destruction.
Definition: ValueHandle.h:383
llvm::AliasSetTracker::begin
const_iterator begin() const
Definition: AliasSetTracker.h:414
llvm::AliasSetTracker::AliasSetTracker
AliasSetTracker(AAResults &AA)
Create an empty collection of AliasSets, and use the specified alias analysis object to disambiguate ...
Definition: AliasSetTracker.h:359
llvm::AliasSet::begin
iterator begin() const
Definition: AliasSetTracker.h:219
llvm::AliasSet::AliasSetTracker
friend class AliasSetTracker
Definition: AliasSetTracker.h:50
llvm::AliasSet::isMustAlias
bool isMustAlias() const
Definition: AliasSetTracker.h:206
ilist_node.h
DenseMapInfo.h
llvm::AliasSet::getUniqueInstruction
Instruction * getUniqueInstruction()
If this alias set is known to contain a single instruction and only a single unique instruction,...
Definition: AliasSetTracker.cpp:261
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
llvm::AliasSet::iterator::value_type
PointerRec value_type
Definition: AliasSetTracker.h:240
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39
From
BlockVerifier::State From
Definition: BlockVerifier.cpp:55
llvm::AliasSet::iterator::operator->
value_type * operator->() const
Definition: AliasSetTracker.h:256
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::MemoryLocation
Representation for a specific memory location.
Definition: MemoryLocation.h:209
llvm::AliasSet::aliasesUnknownInst
bool aliasesUnknownInst(const Instruction *Inst, AAResults &AA) const
Definition: AliasSetTracker.cpp:234
llvm::AliasSetTracker::begin
iterator begin()
Definition: AliasSetTracker.h:417