LLVM 24.0.0git
MemoryDependenceAnalysis.h
Go to the documentation of this file.
1//===- llvm/Analysis/MemoryDependenceAnalysis.h - Memory Deps ---*- 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 the MemoryDependenceAnalysis analysis pass.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_ANALYSIS_MEMORYDEPENDENCEANALYSIS_H
14#define LLVM_ANALYSIS_MEMORYDEPENDENCEANALYSIS_H
15
16#include "llvm/ADT/DenseMap.h"
24#include "llvm/IR/PassManager.h"
26#include "llvm/IR/ValueHandle.h"
27#include "llvm/Pass.h"
28#include <optional>
29
30namespace llvm {
31
32struct AnalysisOptions;
33class AssumptionCache;
34class DominatorTree;
35class PHITransAddr;
36
37/// A memory dependence query can return one of three different answers.
38class MemDepResult {
39 enum DepType {
40 /// Clients of MemDep never see this.
41 ///
42 /// Entries with this marker occur in a LocalDeps map or NonLocalDeps map
43 /// when the instruction they previously referenced was removed from
44 /// MemDep. In either case, the entry may include an instruction pointer.
45 /// If so, the pointer is an instruction in the block where scanning can
46 /// start from, saving some work.
47 ///
48 /// In a default-constructed MemDepResult object, the type will be Invalid
49 /// and the instruction pointer will be null.
50 Invalid = 0,
51
52 /// This is a dependence on the specified instruction which clobbers the
53 /// desired value. The pointer member of the MemDepResult pair holds the
54 /// instruction that clobbers the memory. For example, this occurs when we
55 /// see a may-aliased store to the memory location we care about.
56 ///
57 /// There are several cases that may be interesting here:
58 /// 1. Loads are clobbered by may-alias stores.
59 /// 2. Loads are considered clobbered by partially-aliased loads. The
60 /// client may choose to analyze deeper into these cases.
61 Clobber,
62
63 /// This is a dependence on the specified instruction which defines or
64 /// produces the desired memory location. The pointer member of the
65 /// MemDepResult pair holds the instruction that defines the memory.
66 ///
67 /// Cases of interest:
68 /// 1. This could be a load or store for dependence queries on
69 /// load/store. The value loaded or stored is the produced value.
70 /// Note that the pointer operand may be different than that of the
71 /// queried pointer due to must aliases and phi translation. Note
72 /// that the def may not be the same type as the query, the pointers
73 /// may just be must aliases.
74 /// 2. For loads and stores, this could be an allocation instruction. In
75 /// this case, the load is loading an undef value or a store is the
76 /// first store to (that part of) the allocation.
77 /// 3. Dependence queries on calls return Def only when they are readonly
78 /// calls or memory use intrinsics with identical callees and no
79 /// intervening clobbers. No validation is done that the operands to
80 /// the calls are the same.
81 /// 4. For loads and stores, this could be a select instruction that
82 /// defines pointer to this memory location. In this case, users can
83 /// find non-clobbered Defs for both select values that are reaching
84 // the desired memory location (there is still a guarantee that there
85 // are no clobbers between analyzed memory location and select).
86 Def,
87
88 /// This marker indicates that the query has no known dependency in the
89 /// specified block.
90 ///
91 /// More detailed state info is encoded in the upper part of the pair (i.e.
92 /// the Instruction*)
93 Other
94 };
95
96 /// If DepType is "Other", the upper part of the sum type is an encoding of
97 /// the following more detailed type information.
98 enum OtherType {
99 /// This marker indicates that the query has no dependency in the specified
100 /// block.
101 ///
102 /// To find out more, the client should query other predecessor blocks.
103 NonLocal = 1,
104 /// This marker indicates that the query has no dependency in the specified
105 /// function.
106 NonFuncLocal,
107 /// This marker indicates that the query depends on a select instruction,
108 /// i.e. the address loaded is a select whose two sides each reach a
109 /// non-clobbered value (see the \p Def documentation, item 4).
110 Select,
111 /// This marker indicates that the query dependency is unknown.
112 Unknown
113 };
114
115 using ValueTy = PointerSumType<
120 ValueTy Value;
121
122 explicit MemDepResult(ValueTy V) : Value(V) {}
123
124public:
125 MemDepResult() = default;
126
127 /// get methods: These are static ctor methods for creating various
128 /// MemDepResult kinds.
129 static MemDepResult getDef(Instruction *Inst) {
130 assert(Inst && "Def requires inst");
132 }
133 static MemDepResult getClobber(Instruction *Inst) {
134 assert(Inst && "Clobber requires inst");
136 }
137 static MemDepResult getNonLocal() {
138 return MemDepResult(ValueTy::create<Other>(NonLocal));
139 }
140 static MemDepResult getNonFuncLocal() {
141 return MemDepResult(ValueTy::create<Other>(NonFuncLocal));
142 }
143 static MemDepResult getSelect() {
144 return MemDepResult(ValueTy::create<Other>(Select));
145 }
146 static MemDepResult getUnknown() {
147 return MemDepResult(ValueTy::create<Other>(Unknown));
148 }
149
150 /// Tests if this MemDepResult represents a query that is an instruction
151 /// clobber dependency.
152 bool isClobber() const { return Value.is<Clobber>(); }
153
154 /// Tests if this MemDepResult represents a query that is an instruction
155 /// definition dependency.
156 bool isDef() const { return Value.is<Def>(); }
157
158 /// Tests if this MemDepResult represents a valid local query (Clobber/Def).
159 bool isLocal() const { return isClobber() || isDef(); }
160
161 /// Tests if this MemDepResult represents a query that is transparent to the
162 /// start of the block, but where a non-local hasn't been done.
163 bool isNonLocal() const {
164 return Value.is<Other>() && Value.cast<Other>() == NonLocal;
165 }
166
167 /// Tests if this MemDepResult represents a query that is transparent to the
168 /// start of the function.
169 bool isNonFuncLocal() const {
170 return Value.is<Other>() && Value.cast<Other>() == NonFuncLocal;
171 }
172
173 /// Tests if this MemDepResult represents a query that depends on a select
174 /// instruction whose two sides each reach a non-clobbered value.
175 bool isSelect() const {
176 return Value.is<Other>() && Value.cast<Other>() == Select;
177 }
178
179 /// Tests if this MemDepResult represents a query which cannot and/or will
180 /// not be computed.
181 bool isUnknown() const {
182 return Value.is<Other>() && Value.cast<Other>() == Unknown;
183 }
184
185 /// If this is a normal dependency, returns the instruction that is depended
186 /// on. Otherwise, returns null.
188 switch (Value.getTag()) {
189 case Invalid:
190 return Value.cast<Invalid>();
191 case Clobber:
192 return Value.cast<Clobber>();
193 case Def:
194 return Value.cast<Def>();
195 case Other:
196 return nullptr;
197 }
198 llvm_unreachable("Unknown discriminant!");
199 }
200
201 bool operator==(const MemDepResult &M) const { return Value == M.Value; }
202 bool operator!=(const MemDepResult &M) const { return Value != M.Value; }
203 bool operator<(const MemDepResult &M) const { return Value < M.Value; }
204 bool operator>(const MemDepResult &M) const { return Value > M.Value; }
205
206private:
208
209 /// Tests if this is a MemDepResult in its dirty/invalid. state.
210 bool isDirty() const { return Value.is<Invalid>(); }
211
212 static MemDepResult getDirty(Instruction *Inst) {
214 }
215};
216
217/// This is an entry in the NonLocalDepInfo cache.
218///
219/// For each BasicBlock (the BB entry) it keeps a MemDepResult.
221 BasicBlock *BB;
222 MemDepResult Result;
223
224public:
226 : BB(BB), Result(Result) {}
227
228 // This is used for searches.
230
231 // BB is the sort key, it can't be changed.
232 BasicBlock *getBB() const { return BB; }
233
234 void setResult(const MemDepResult &R) { Result = R; }
235
236 const MemDepResult &getResult() const { return Result; }
237
238 bool operator<(const NonLocalDepEntry &RHS) const { return BB < RHS.BB; }
239};
240
241/// This is a result from a NonLocal dependence query.
242///
243/// For each BasicBlock (the BB entry) it keeps a MemDepResult and the
244/// (potentially phi translated) address that was live in the block.
246 NonLocalDepEntry Entry;
247 SelectAddr Address;
248
249public:
251 const SelectAddr &Address)
252 : Entry(BB, Result), Address(Address) {}
253
254 // BB is the sort key, it can't be changed.
255 BasicBlock *getBB() const { return Entry.getBB(); }
256
257 void setResult(const MemDepResult &R, const SelectAddr &Addr) {
258 Entry.setResult(R);
259 Address = Addr;
260 }
261
262 const MemDepResult &getResult() const { return Entry.getResult(); }
263
264 /// Returns the address of this pointer in this block.
265 ///
266 /// This can be different than the address queried for the non-local result
267 /// because of phi translation. This returns null if the address was not
268 /// available in a block (i.e. because phi translation failed) or if this is
269 /// a cached result and that address was deleted.
270 ///
271 /// The address is always null for a non-local 'call' dependence.
272 ///
273 /// If the result is a select dependency (\see MemDepResult::isSelect), the
274 /// returned SelectAddr instead carries the select instruction and the two
275 /// translated addresses (true/false side).
276 SelectAddr getAddress() const { return Address; }
277};
278
279/// Provides a lazy, caching interface for making common memory aliasing
280/// information queries, backed by LLVM's alias analysis passes.
281///
282/// The dependency information returned is somewhat unusual, but is pragmatic.
283/// If queried about a store or call that might modify memory, the analysis
284/// will return the instruction[s] that may either load from that memory or
285/// store to it. If queried with a load or call that can never modify memory,
286/// the analysis will return calls and stores that might modify the pointer,
287/// but generally does not return loads unless a) they are volatile, or
288/// b) they load from *must-aliased* pointers. Returning a dependence on
289/// must-alias'd pointers instead of all pointers interacts well with the
290/// internal caching mechanism.
292 const AnalysisOptions &Opts;
293
294 // A map from instructions to their dependency.
295 using LocalDepMapType = DenseMap<Instruction *, MemDepResult>;
296 LocalDepMapType LocalDeps;
297
298public:
299 using NonLocalDepInfo = std::vector<NonLocalDepEntry>;
300
301private:
302 /// A pair<Value*, bool> where the bool is true if the dependence is a read
303 /// only dependence, false if read/write.
304 using ValueIsLoadPair = PointerIntPair<const Value *, 1, bool>;
305
306 /// This pair is used when caching information for a block.
307 ///
308 /// If the pointer is null, the cache value is not a full query that starts
309 /// at the specified block. If non-null, the bool indicates whether or not
310 /// the contents of the block was skipped.
311 using BBSkipFirstBlockPair = PointerIntPair<BasicBlock *, 1, bool>;
312
313 /// This record is the information kept for each (value, is load) pair.
314 struct NonLocalPointerInfo {
315 /// The pair of the block and the skip-first-block flag.
316 BBSkipFirstBlockPair Pair;
317 /// The results of the query for each relevant block.
318 NonLocalDepInfo NonLocalDeps;
319 /// The maximum size of the dereferences of the pointer.
320 ///
321 /// May be UnknownSize if the sizes are unknown.
323 /// The AA tags associated with dereferences of the pointer.
324 ///
325 /// The members may be null if there are no tags or conflicting tags.
326 AAMDNodes AATags;
327
328 NonLocalPointerInfo() = default;
329 };
330
331 /// Cache storing single nonlocal def for the instruction.
332 /// It is set when nonlocal def would be found in function returning only
333 /// local dependencies.
335 using ReverseNonLocalDefsCacheTy =
337 ReverseNonLocalDefsCacheTy ReverseNonLocalDefsCache;
338
339 /// This map stores the cached results of doing a pointer lookup at the
340 /// bottom of a block.
341 ///
342 /// The key of this map is the pointer+isload bit, the value is a list of
343 /// <bb->result> mappings.
344 using CachedNonLocalPointerInfo =
346 CachedNonLocalPointerInfo NonLocalPointerDeps;
347
348 // A map from instructions to their non-local pointer dependencies.
349 using ReverseNonLocalPtrDepTy =
351 ReverseNonLocalPtrDepTy ReverseNonLocalPtrDeps;
352
353 /// This is the instruction we keep for each cached access that we have for
354 /// an instruction.
355 ///
356 /// The pointer is an owning pointer and the bool indicates whether we have
357 /// any dirty bits in the set.
358 using PerInstNLInfo = std::pair<NonLocalDepInfo, bool>;
359
360 // A map from instructions to their non-local dependencies.
361 using NonLocalDepMapType = DenseMap<Instruction *, PerInstNLInfo>;
362
363 NonLocalDepMapType NonLocalDepsMap;
364
365 // A reverse mapping from dependencies to the dependees. This is
366 // used when removing instructions to keep the cache coherent.
367 using ReverseDepMapType =
369 ReverseDepMapType ReverseLocalDeps;
370
371 // A reverse mapping from dependencies to the non-local dependees.
372 ReverseDepMapType ReverseNonLocalDeps;
373
374 /// Visited map for getNonLocalPointerDependency. Stored here to reuse the
375 /// allocation. Map from block number to Value; second value is epoch to
376 /// avoid clearing the vector for each query.
377 SmallVector<std::pair<Value *, unsigned>, 0> NonLocalPointerDepVisited;
378 unsigned NonLocalPointerDepEpoch = 0;
379
380 /// Current AA implementation, just a cache.
381 AAResults &AA;
382 AssumptionCache &AC;
383 const TargetLibraryInfo &TLI;
384 DominatorTree &DT;
385 PredIteratorCache PredCache;
387
388 unsigned DefaultBlockScanLimit;
389
390 /// Offsets to dependant clobber loads.
391 using ClobberOffsetsMapType = DenseMap<LoadInst *, int32_t>;
392 ClobberOffsetsMapType ClobberOffsets;
393
394public:
396 const TargetLibraryInfo &TLI,
397 DominatorTree &DT,
398 unsigned DefaultBlockScanLimit);
399
400 /// Handle invalidation in the new PM.
402 FunctionAnalysisManager::Invalidator &Inv);
403
404 /// Some methods limit the number of instructions they will examine.
405 /// The return value of this method is the default limit that will be
406 /// used if no limit is explicitly passed in.
407 LLVM_ABI unsigned getDefaultBlockScanLimit() const;
408
409 /// Returns the instruction on which a memory operation depends.
410 ///
411 /// See the class comment for more details. It is illegal to call this on
412 /// non-memory instructions.
414
415 /// Perform a full dependency query for the specified call, returning the set
416 /// of blocks that the value is potentially live across.
417 ///
418 /// The returned set of results will include a "NonLocal" result for all
419 /// blocks where the value is live across.
420 ///
421 /// This method assumes the instruction returns a "NonLocal" dependency
422 /// within its own block.
423 ///
424 /// This returns a reference to an internal data structure that may be
425 /// invalidated on the next non-local query or when an instruction is
426 /// removed. Clients must copy this data if they want it around longer than
427 /// that.
430
431 /// Perform a full dependency query for an access to the QueryInst's
432 /// specified memory location, returning the set of instructions that either
433 /// define or clobber the value.
434 ///
435 /// Warning: For a volatile query instruction, the dependencies will be
436 /// accurate, and thus usable for reordering, but it is never legal to
437 /// remove the query instruction.
438 ///
439 /// This method assumes the pointer has a "NonLocal" dependency within
440 /// QueryInst's parent basic block.
441 LLVM_ABI void
444
445 /// Removes an instruction from the dependence analysis, updating the
446 /// dependence of instructions that previously depended on it.
447 LLVM_ABI void removeInstruction(Instruction *InstToRemove);
448
449 /// Invalidates cached information about the specified pointer, because it
450 /// may be too conservative in memdep.
451 ///
452 /// This is an optional call that can be used when the client detects an
453 /// equivalence between the pointer and some other value and replaces the
454 /// other value with ptr. This can make Ptr available in more places that
455 /// cached info does not necessarily keep.
457
458 /// Clears the PredIteratorCache info.
459 ///
460 /// This needs to be done when the CFG changes, e.g., due to splitting
461 /// critical edges.
463
464 /// Returns the instruction on which a memory location depends.
465 ///
466 /// If isLoad is true, this routine ignores may-aliases with read-only
467 /// operations. If isLoad is false, this routine ignores may-aliases
468 /// with reads from read-only locations. If possible, pass the query
469 /// instruction as well; this function may take advantage of the metadata
470 /// annotated to the query instruction to refine the result. \p Limit
471 /// can be used to set the maximum number of instructions that will be
472 /// examined to find the pointer dependency. On return, it will be set to
473 /// the number of instructions left to examine. If a null pointer is passed
474 /// in, the limit will default to the value of -memdep-block-scan-limit.
475 ///
476 /// Note that this is an uncached query, and thus may be inefficient.
478 const MemoryLocation &Loc, bool isLoad, BasicBlock::iterator ScanIt,
479 BasicBlock *BB, Instruction *QueryInst = nullptr,
480 unsigned *Limit = nullptr);
481
483 const MemoryLocation &Loc, bool isLoad, BasicBlock::iterator ScanIt,
484 BasicBlock *BB, Instruction *QueryInst, unsigned *Limit,
485 BatchAAResults &BatchAA);
486
488 const MemoryLocation &MemLoc, bool isLoad, BasicBlock::iterator ScanIt,
489 BasicBlock *BB, Instruction *QueryInst, unsigned *Limit,
490 BatchAAResults &BatchAA);
491
492 /// This analysis looks for other loads and stores with invariant.group
493 /// metadata and the same pointer operand. Returns Unknown if it does not
494 /// find anything, and Def if it can be assumed that 2 instructions load or
495 /// store the same value and NonLocal which indicate that non-local Def was
496 /// found, which can be retrieved by calling getNonLocalPointerDependency
497 /// with the same queried instruction.
499 BasicBlock *BB);
500
501 /// Return the clobber offset to dependent instruction.
502 std::optional<int32_t> getClobberOffset(LoadInst *DepInst) const {
503 const auto Off = ClobberOffsets.find(DepInst);
504 if (Off != ClobberOffsets.end())
505 return Off->getSecond();
506 return std::nullopt;
507 }
508
509private:
510 MemDepResult getCallDependencyFrom(CallBase *Call, bool isReadOnlyCall,
512 BasicBlock *BB);
513 void setNonLocalPointerDepVisited(BasicBlock *BB, Value *V);
514 bool isNonLocalPointerDepVisited(BasicBlock *BB) const;
515 Value *lookupNonLocalPointerDepVisited(BasicBlock *BB) const;
516 bool getNonLocalPointerDepFromBB(Instruction *QueryInst,
517 const PHITransAddr &Pointer,
518 const MemoryLocation &Loc, bool isLoad,
519 BasicBlock *BB,
521 bool SkipFirstBlock = false,
522 bool IsIncomplete = false);
523 MemDepResult getNonLocalInfoForBlock(Instruction *QueryInst,
524 const MemoryLocation &Loc, bool isLoad,
525 BasicBlock *BB, NonLocalDepInfo *Cache,
526 unsigned NumSortedEntries,
527 BatchAAResults &BatchAA);
528
529 void removeCachedNonLocalPointerDependencies(ValueIsLoadPair P);
530
531 void verifyRemoved(Instruction *Inst) const;
532};
533
534/// An analysis that produces \c MemoryDependenceResults for a function.
535///
536/// This is essentially a no-op because the results are computed entirely
537/// lazily.
539 : public AnalysisInfoMixin<MemoryDependenceAnalysis> {
541
542 static AnalysisKey Key;
543
544 std::optional<unsigned> DefaultBlockScanLimit;
545
546public:
548
550 MemoryDependenceAnalysis(unsigned DefaultBlockScanLimit) : DefaultBlockScanLimit(DefaultBlockScanLimit) { }
551
554};
555
556/// A wrapper analysis pass for the legacy pass manager that exposes a \c
557/// MemoryDepnedenceResults instance.
559 std::optional<MemoryDependenceResults> MemDep;
560
561public:
562 static char ID;
563
566
567 /// Pass Implementation stuff. This doesn't do any analysis eagerly.
568 bool runOnFunction(Function &) override;
569
570 /// Clean up memory in between runs
571 void releaseMemory() override;
572
573 /// Does not modify anything. It uses Value Numbering and Alias Analysis.
574 void getAnalysisUsage(AnalysisUsage &AU) const override;
575
576 MemoryDependenceResults &getMemDep() { return *MemDep; }
577};
578
579} // end namespace llvm
580
581#endif // LLVM_ANALYSIS_MEMORYDEPENDENCEANALYSIS_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static bool isLoad(int Opcode)
#define LLVM_ABI
Definition Compiler.h:211
This file defines the DenseMap class.
static bool runOnFunction(Function &F, bool PostInlining)
This header defines various interfaces for pass management in LLVM.
#define F(x, y, z)
Definition MD5.cpp:54
This file provides utility analysis objects describing memory locations.
#define P(N)
This file defines the PointerIntPair class.
This file defines the SmallPtrSet class.
Value * RHS
Represent the analysis usage information of a pass.
A cache of @llvm.assume calls within a function.
LLVM Basic Block Representation.
Definition BasicBlock.h:62
InstListType::iterator iterator
Instruction iterators...
Definition BasicBlock.h:170
This class is a wrapper over an AAResults, and it is intended to be used only when there are no IR ch...
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition Dominators.h:122
Context-sensitive CaptureAnalysis provider, which computes and caches the earliest common dominator c...
FunctionPass(char &pid)
Definition Pass.h:314
An instruction for reading from memory.
static constexpr LocationSize afterPointer()
Any location after the base pointer (but still within the underlying object).
A memory dependence query can return one of three different answers.
bool isClobber() const
Tests if this MemDepResult represents a query that is an instruction clobber dependency.
bool operator!=(const MemDepResult &M) const
bool isNonLocal() const
Tests if this MemDepResult represents a query that is transparent to the start of the block,...
static MemDepResult getNonLocal()
bool isNonFuncLocal() const
Tests if this MemDepResult represents a query that is transparent to the start of the function.
static MemDepResult getSelect()
bool operator>(const MemDepResult &M) const
static MemDepResult getClobber(Instruction *Inst)
bool isDef() const
Tests if this MemDepResult represents a query that is an instruction definition dependency.
bool operator==(const MemDepResult &M) const
static MemDepResult getUnknown()
bool isSelect() const
Tests if this MemDepResult represents a query that depends on a select instruction whose two sides ea...
bool operator<(const MemDepResult &M) const
MemDepResult()=default
bool isLocal() const
Tests if this MemDepResult represents a valid local query (Clobber/Def).
bool isUnknown() const
Tests if this MemDepResult represents a query which cannot and/or will not be computed.
static MemDepResult getNonFuncLocal()
static MemDepResult getDef(Instruction *Inst)
get methods: These are static ctor methods for creating various MemDepResult kinds.
Instruction * getInst() const
If this is a normal dependency, returns the instruction that is depended on.
LLVM_ABI MemoryDependenceResults run(Function &F, FunctionAnalysisManager &AM)
MemoryDependenceAnalysis(unsigned DefaultBlockScanLimit)
Provides a lazy, caching interface for making common memory aliasing information queries,...
LLVM_ABI MemDepResult getSimplePointerDependencyFrom(const MemoryLocation &MemLoc, bool isLoad, BasicBlock::iterator ScanIt, BasicBlock *BB, Instruction *QueryInst, unsigned *Limit, BatchAAResults &BatchAA)
std::vector< NonLocalDepEntry > NonLocalDepInfo
LLVM_ABI void invalidateCachedPredecessors()
Clears the PredIteratorCache info.
LLVM_ABI void invalidateCachedPointerInfo(Value *Ptr)
Invalidates cached information about the specified pointer, because it may be too conservative in mem...
LLVM_ABI MemDepResult getPointerDependencyFrom(const MemoryLocation &Loc, bool isLoad, BasicBlock::iterator ScanIt, BasicBlock *BB, Instruction *QueryInst=nullptr, unsigned *Limit=nullptr)
Returns the instruction on which a memory location depends.
std::optional< int32_t > getClobberOffset(LoadInst *DepInst) const
Return the clobber offset to dependent instruction.
LLVM_ABI void removeInstruction(Instruction *InstToRemove)
Removes an instruction from the dependence analysis, updating the dependence of instructions that pre...
LLVM_ABI MemoryDependenceResults(AAResults &AA, AssumptionCache &AC, const TargetLibraryInfo &TLI, DominatorTree &DT, unsigned DefaultBlockScanLimit)
LLVM_ABI MemDepResult getInvariantGroupPointerDependency(LoadInst *LI, BasicBlock *BB)
This analysis looks for other loads and stores with invariant.group metadata and the same pointer ope...
LLVM_ABI unsigned getDefaultBlockScanLimit() const
Some methods limit the number of instructions they will examine.
LLVM_ABI MemDepResult getDependency(Instruction *QueryInst)
Returns the instruction on which a memory operation depends.
LLVM_ABI const NonLocalDepInfo & getNonLocalCallDependency(CallBase *QueryCall)
Perform a full dependency query for the specified call, returning the set of blocks that the value is...
LLVM_ABI void getNonLocalPointerDependency(Instruction *QueryInst, SmallVectorImpl< NonLocalDepResult > &Result)
Perform a full dependency query for an access to the QueryInst's specified memory location,...
LLVM_ABI bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &Inv)
Handle invalidation in the new PM.
void getAnalysisUsage(AnalysisUsage &AU) const override
Does not modify anything. It uses Value Numbering and Alias Analysis.
void releaseMemory() override
Clean up memory in between runs.
Representation for a specific memory location.
This is an entry in the NonLocalDepInfo cache.
void setResult(const MemDepResult &R)
NonLocalDepEntry(BasicBlock *BB, MemDepResult Result)
bool operator<(const NonLocalDepEntry &RHS) const
const MemDepResult & getResult() const
This is a result from a NonLocal dependence query.
void setResult(const MemDepResult &R, const SelectAddr &Addr)
const MemDepResult & getResult() const
NonLocalDepResult(BasicBlock *BB, MemDepResult Result, const SelectAddr &Address)
SelectAddr getAddress() const
Returns the address of this pointer in this block.
PHITransAddr - An address value which tracks and handles phi translation.
PointerIntPair - This class implements a pair of a pointer and small integer.
A sum type over pointer-like types.
PredIteratorCache - This class is an extremely trivial cache for predecessor iterator queries.
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
Storage of either a normal Value address, or a select instruction together with a pair of addresses f...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Provides information about what library functions are available for the current target.
LLVM Value Representation.
Definition Value.h:75
CallInst * Call
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Abstract Attribute helper functions.
Definition Attributor.h:164
This is an optimization pass for GlobalISel generic memory operations.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
Definition InstrProf.h:143
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
Definition Metadata.h:774
A CRTP mix-in that provides informational APIs needed for analysis passes.
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition Analysis.h:29
A compile time pair of an integer tag and the pointer-like type which it indexes within a sum type.