LLVM 19.0.0git
AliasAnalysis.h
Go to the documentation of this file.
1//===- llvm/Analysis/AliasAnalysis.h - Alias Analysis Interface -*- 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 generic AliasAnalysis interface, which is used as the
10// common interface used by all clients of alias analysis information, and
11// implemented by all alias analysis implementations. Mod/Ref information is
12// also captured by this interface.
13//
14// Implementations of this interface must implement the various virtual methods,
15// which automatically provides functionality for the entire suite of client
16// APIs.
17//
18// This API identifies memory regions with the MemoryLocation class. The pointer
19// component specifies the base memory address of the region. The Size specifies
20// the maximum size (in address units) of the memory region, or
21// MemoryLocation::UnknownSize if the size is not known. The TBAA tag
22// identifies the "type" of the memory reference; see the
23// TypeBasedAliasAnalysis class for details.
24//
25// Some non-obvious details include:
26// - Pointers that point to two completely different objects in memory never
27// alias, regardless of the value of the Size component.
28// - NoAlias doesn't imply inequal pointers. The most obvious example of this
29// is two pointers to constant memory. Even if they are equal, constant
30// memory is never stored to, so there will never be any dependencies.
31// In this and other situations, the pointers may be both NoAlias and
32// MustAlias at the same time. The current API can only return one result,
33// though this is rarely a problem in practice.
34//
35//===----------------------------------------------------------------------===//
36
37#ifndef LLVM_ANALYSIS_ALIASANALYSIS_H
38#define LLVM_ANALYSIS_ALIASANALYSIS_H
39
40#include "llvm/ADT/DenseMap.h"
41#include "llvm/ADT/Sequence.h"
44#include "llvm/IR/PassManager.h"
45#include "llvm/Pass.h"
46#include "llvm/Support/ModRef.h"
47#include <cstdint>
48#include <functional>
49#include <memory>
50#include <optional>
51#include <vector>
52
53namespace llvm {
54
55class AnalysisUsage;
56class AtomicCmpXchgInst;
57class BasicBlock;
58class CatchPadInst;
59class CatchReturnInst;
60class DominatorTree;
61class FenceInst;
62class Function;
63class LoopInfo;
64class PreservedAnalyses;
65class TargetLibraryInfo;
66class Value;
67
68/// The possible results of an alias query.
69///
70/// These results are always computed between two MemoryLocation objects as
71/// a query to some alias analysis.
72///
73/// Note that these are unscoped enumerations because we would like to support
74/// implicitly testing a result for the existence of any possible aliasing with
75/// a conversion to bool, but an "enum class" doesn't support this. The
76/// canonical names from the literature are suffixed and unique anyways, and so
77/// they serve as global constants in LLVM for these results.
78///
79/// See docs/AliasAnalysis.html for more information on the specific meanings
80/// of these values.
82private:
83 static const int OffsetBits = 23;
84 static const int AliasBits = 8;
85 static_assert(AliasBits + 1 + OffsetBits <= 32,
86 "AliasResult size is intended to be 4 bytes!");
87
88 unsigned int Alias : AliasBits;
89 unsigned int HasOffset : 1;
90 signed int Offset : OffsetBits;
91
92public:
93 enum Kind : uint8_t {
94 /// The two locations do not alias at all.
95 ///
96 /// This value is arranged to convert to false, while all other values
97 /// convert to true. This allows a boolean context to convert the result to
98 /// a binary flag indicating whether there is the possibility of aliasing.
100 /// The two locations may or may not alias. This is the least precise
101 /// result.
103 /// The two locations alias, but only due to a partial overlap.
105 /// The two locations precisely alias each other.
107 };
108 static_assert(MustAlias < (1 << AliasBits),
109 "Not enough bit field size for the enum!");
110
111 explicit AliasResult() = delete;
112 constexpr AliasResult(const Kind &Alias)
113 : Alias(Alias), HasOffset(false), Offset(0) {}
114
115 operator Kind() const { return static_cast<Kind>(Alias); }
116
117 bool operator==(const AliasResult &Other) const {
118 return Alias == Other.Alias && HasOffset == Other.HasOffset &&
119 Offset == Other.Offset;
120 }
121 bool operator!=(const AliasResult &Other) const { return !(*this == Other); }
122
123 bool operator==(Kind K) const { return Alias == K; }
124 bool operator!=(Kind K) const { return !(*this == K); }
125
126 constexpr bool hasOffset() const { return HasOffset; }
127 constexpr int32_t getOffset() const {
128 assert(HasOffset && "No offset!");
129 return Offset;
130 }
131 void setOffset(int32_t NewOffset) {
132 if (isInt<OffsetBits>(NewOffset)) {
133 HasOffset = true;
134 Offset = NewOffset;
135 }
136 }
137
138 /// Helper for processing AliasResult for swapped memory location pairs.
139 void swap(bool DoSwap = true) {
140 if (DoSwap && hasOffset())
142 }
143};
144
145static_assert(sizeof(AliasResult) == 4,
146 "AliasResult size is intended to be 4 bytes!");
147
148/// << operator for AliasResult.
149raw_ostream &operator<<(raw_ostream &OS, AliasResult AR);
150
151/// Virtual base class for providers of capture information.
153 virtual ~CaptureInfo() = 0;
154
155 /// Check whether Object is not captured before instruction I. If OrAt is
156 /// true, captures by instruction I itself are also considered.
157 ///
158 /// If I is nullptr, then captures at any point will be considered.
159 virtual bool isNotCapturedBefore(const Value *Object, const Instruction *I,
160 bool OrAt) = 0;
161};
162
163/// Context-free CaptureInfo provider, which computes and caches whether an
164/// object is captured in the function at all, but does not distinguish whether
165/// it was captured before or after the context instruction.
166class SimpleCaptureInfo final : public CaptureInfo {
168
169public:
170 bool isNotCapturedBefore(const Value *Object, const Instruction *I,
171 bool OrAt) override;
172};
173
174/// Context-sensitive CaptureInfo provider, which computes and caches the
175/// earliest common dominator closure of all captures. It provides a good
176/// approximation to a precise "captures before" analysis.
177class EarliestEscapeInfo final : public CaptureInfo {
178 DominatorTree &DT;
179 const LoopInfo *LI;
180
181 /// Map from identified local object to an instruction before which it does
182 /// not escape, or nullptr if it never escapes. The "earliest" instruction
183 /// may be a conservative approximation, e.g. the first instruction in the
184 /// function is always a legal choice.
186
187 /// Reverse map from instruction to the objects it is the earliest escape for.
188 /// This is used for cache invalidation purposes.
190
191public:
192 EarliestEscapeInfo(DominatorTree &DT, const LoopInfo *LI = nullptr)
193 : DT(DT), LI(LI) {}
194
195 bool isNotCapturedBefore(const Value *Object, const Instruction *I,
196 bool OrAt) override;
197
199};
200
201/// Cache key for BasicAA results. It only includes the pointer and size from
202/// MemoryLocation, as BasicAA is AATags independent. Additionally, it includes
203/// the value of MayBeCrossIteration, which may affect BasicAA results.
208
210 AACacheLoc(const Value *Ptr, LocationSize Size, bool MayBeCrossIteration)
211 : Ptr(Ptr, MayBeCrossIteration), Size(Size) {}
212};
213
214template <> struct DenseMapInfo<AACacheLoc> {
215 static inline AACacheLoc getEmptyKey() {
218 }
219 static inline AACacheLoc getTombstoneKey() {
222 }
223 static unsigned getHashValue(const AACacheLoc &Val) {
226 }
227 static bool isEqual(const AACacheLoc &LHS, const AACacheLoc &RHS) {
228 return LHS.Ptr == RHS.Ptr && LHS.Size == RHS.Size;
229 }
230};
231
232class AAResults;
233
234/// This class stores info we want to provide to or retain within an alias
235/// query. By default, the root query is stateless and starts with a freshly
236/// constructed info object. Specific alias analyses can use this query info to
237/// store per-query state that is important for recursive or nested queries to
238/// avoid recomputing. To enable preserving this state across multiple queries
239/// where safe (due to the IR not changing), use a `BatchAAResults` wrapper.
240/// The information stored in an `AAQueryInfo` is currently limitted to the
241/// caches used by BasicAA, but can further be extended to fit other AA needs.
243public:
244 using LocPair = std::pair<AACacheLoc, AACacheLoc>;
245 struct CacheEntry {
247 /// Number of times a NoAlias assumption has been used.
248 /// 0 for assumptions that have not been used, -1 for definitive results.
250 /// Whether this is a definitive (non-assumption) result.
251 bool isDefinitive() const { return NumAssumptionUses < 0; }
252 };
253
254 // Alias analysis result aggregration using which this query is performed.
255 // Can be used to perform recursive queries.
257
260
262
263 /// Query depth used to distinguish recursive queries.
264 unsigned Depth = 0;
265
266 /// How many active NoAlias assumption uses there are.
268
269 /// Location pairs for which an assumption based result is currently stored.
270 /// Used to remove all potentially incorrect results from the cache if an
271 /// assumption is disproven.
273
274 /// Tracks whether the accesses may be on different cycle iterations.
275 ///
276 /// When interpret "Value" pointer equality as value equality we need to make
277 /// sure that the "Value" is not part of a cycle. Otherwise, two uses could
278 /// come from different "iterations" of a cycle and see different values for
279 /// the same "Value" pointer.
280 ///
281 /// The following example shows the problem:
282 /// %p = phi(%alloca1, %addr2)
283 /// %l = load %ptr
284 /// %addr1 = gep, %alloca2, 0, %l
285 /// %addr2 = gep %alloca2, 0, (%l + 1)
286 /// alias(%p, %addr1) -> MayAlias !
287 /// store %l, ...
289
290 /// Whether alias analysis is allowed to use the dominator tree, for use by
291 /// passes that lazily update the DT while performing AA queries.
292 bool UseDominatorTree = true;
293
295};
296
297/// AAQueryInfo that uses SimpleCaptureInfo.
300
301public:
303};
304
305class BatchAAResults;
306
308public:
309 // Make these results default constructable and movable. We have to spell
310 // these out because MSVC won't synthesize them.
311 AAResults(const TargetLibraryInfo &TLI) : TLI(TLI) {}
312 AAResults(AAResults &&Arg);
313 ~AAResults();
314
315 /// Register a specific AA result.
316 template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
317 // FIXME: We should use a much lighter weight system than the usual
318 // polymorphic pattern because we don't own AAResult. It should
319 // ideally involve two pointers and no separate allocation.
320 AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
321 }
322
323 /// Register a function analysis ID that the results aggregation depends on.
324 ///
325 /// This is used in the new pass manager to implement the invalidation logic
326 /// where we must invalidate the results aggregation if any of our component
327 /// analyses become invalid.
328 void addAADependencyID(AnalysisKey *ID) { AADeps.push_back(ID); }
329
330 /// Handle invalidation events in the new pass manager.
331 ///
332 /// The aggregation is invalidated if any of the underlying analyses is
333 /// invalidated.
334 bool invalidate(Function &F, const PreservedAnalyses &PA,
336
337 //===--------------------------------------------------------------------===//
338 /// \name Alias Queries
339 /// @{
340
341 /// The main low level interface to the alias analysis implementation.
342 /// Returns an AliasResult indicating whether the two pointers are aliased to
343 /// each other. This is the interface that must be implemented by specific
344 /// alias analysis implementations.
345 AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB);
346
347 /// A convenience wrapper around the primary \c alias interface.
348 AliasResult alias(const Value *V1, LocationSize V1Size, const Value *V2,
349 LocationSize V2Size) {
350 return alias(MemoryLocation(V1, V1Size), MemoryLocation(V2, V2Size));
351 }
352
353 /// A convenience wrapper around the primary \c alias interface.
354 AliasResult alias(const Value *V1, const Value *V2) {
357 }
358
359 /// A trivial helper function to check to see if the specified pointers are
360 /// no-alias.
361 bool isNoAlias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
362 return alias(LocA, LocB) == AliasResult::NoAlias;
363 }
364
365 /// A convenience wrapper around the \c isNoAlias helper interface.
366 bool isNoAlias(const Value *V1, LocationSize V1Size, const Value *V2,
367 LocationSize V2Size) {
368 return isNoAlias(MemoryLocation(V1, V1Size), MemoryLocation(V2, V2Size));
369 }
370
371 /// A convenience wrapper around the \c isNoAlias helper interface.
372 bool isNoAlias(const Value *V1, const Value *V2) {
375 }
376
377 /// A trivial helper function to check to see if the specified pointers are
378 /// must-alias.
379 bool isMustAlias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
380 return alias(LocA, LocB) == AliasResult::MustAlias;
381 }
382
383 /// A convenience wrapper around the \c isMustAlias helper interface.
384 bool isMustAlias(const Value *V1, const Value *V2) {
385 return alias(V1, LocationSize::precise(1), V2, LocationSize::precise(1)) ==
387 }
388
389 /// Checks whether the given location points to constant memory, or if
390 /// \p OrLocal is true whether it points to a local alloca.
391 bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal = false) {
392 return isNoModRef(getModRefInfoMask(Loc, OrLocal));
393 }
394
395 /// A convenience wrapper around the primary \c pointsToConstantMemory
396 /// interface.
397 bool pointsToConstantMemory(const Value *P, bool OrLocal = false) {
399 }
400
401 /// @}
402 //===--------------------------------------------------------------------===//
403 /// \name Simple mod/ref information
404 /// @{
405
406 /// Returns a bitmask that should be unconditionally applied to the ModRef
407 /// info of a memory location. This allows us to eliminate Mod and/or Ref
408 /// from the ModRef info based on the knowledge that the memory location
409 /// points to constant and/or locally-invariant memory.
410 ///
411 /// If IgnoreLocals is true, then this method returns NoModRef for memory
412 /// that points to a local alloca.
414 bool IgnoreLocals = false);
415
416 /// A convenience wrapper around the primary \c getModRefInfoMask
417 /// interface.
418 ModRefInfo getModRefInfoMask(const Value *P, bool IgnoreLocals = false) {
420 }
421
422 /// Get the ModRef info associated with a pointer argument of a call. The
423 /// result's bits are set to indicate the allowed aliasing ModRef kinds. Note
424 /// that these bits do not necessarily account for the overall behavior of
425 /// the function, but rather only provide additional per-argument
426 /// information.
427 ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx);
428
429 /// Return the behavior of the given call site.
431
432 /// Return the behavior when calling the given function.
434
435 /// Checks if the specified call is known to never read or write memory.
436 ///
437 /// Note that if the call only reads from known-constant memory, it is also
438 /// legal to return true. Also, calls that unwind the stack are legal for
439 /// this predicate.
440 ///
441 /// Many optimizations (such as CSE and LICM) can be performed on such calls
442 /// without worrying about aliasing properties, and many calls have this
443 /// property (e.g. calls to 'sin' and 'cos').
444 ///
445 /// This property corresponds to the GCC 'const' attribute.
446 bool doesNotAccessMemory(const CallBase *Call) {
448 }
449
450 /// Checks if the specified function is known to never read or write memory.
451 ///
452 /// Note that if the function only reads from known-constant memory, it is
453 /// also legal to return true. Also, function that unwind the stack are legal
454 /// for this predicate.
455 ///
456 /// Many optimizations (such as CSE and LICM) can be performed on such calls
457 /// to such functions without worrying about aliasing properties, and many
458 /// functions have this property (e.g. 'sin' and 'cos').
459 ///
460 /// This property corresponds to the GCC 'const' attribute.
463 }
464
465 /// Checks if the specified call is known to only read from non-volatile
466 /// memory (or not access memory at all).
467 ///
468 /// Calls that unwind the stack are legal for this predicate.
469 ///
470 /// This property allows many common optimizations to be performed in the
471 /// absence of interfering store instructions, such as CSE of strlen calls.
472 ///
473 /// This property corresponds to the GCC 'pure' attribute.
474 bool onlyReadsMemory(const CallBase *Call) {
475 return getMemoryEffects(Call).onlyReadsMemory();
476 }
477
478 /// Checks if the specified function is known to only read from non-volatile
479 /// memory (or not access memory at all).
480 ///
481 /// Functions that unwind the stack are legal for this predicate.
482 ///
483 /// This property allows many common optimizations to be performed in the
484 /// absence of interfering store instructions, such as CSE of strlen calls.
485 ///
486 /// This property corresponds to the GCC 'pure' attribute.
489 }
490
491 /// Check whether or not an instruction may read or write the optionally
492 /// specified memory location.
493 ///
494 ///
495 /// An instruction that doesn't read or write memory may be trivially LICM'd
496 /// for example.
497 ///
498 /// For function calls, this delegates to the alias-analysis specific
499 /// call-site mod-ref behavior queries. Otherwise it delegates to the specific
500 /// helpers above.
502 const std::optional<MemoryLocation> &OptLoc) {
503 SimpleAAQueryInfo AAQIP(*this);
504 return getModRefInfo(I, OptLoc, AAQIP);
505 }
506
507 /// A convenience wrapper for constructing the memory location.
511 }
512
513 /// Return information about whether a call and an instruction may refer to
514 /// the same memory locations.
515 ModRefInfo getModRefInfo(const Instruction *I, const CallBase *Call);
516
517 /// Return information about whether a particular call site modifies
518 /// or reads the specified memory location \p MemLoc before instruction \p I
519 /// in a BasicBlock.
521 const MemoryLocation &MemLoc,
522 DominatorTree *DT) {
523 SimpleAAQueryInfo AAQIP(*this);
524 return callCapturesBefore(I, MemLoc, DT, AAQIP);
525 }
526
527 /// A convenience wrapper to synthesize a memory location.
531 }
532
533 /// @}
534 //===--------------------------------------------------------------------===//
535 /// \name Higher level methods for querying mod/ref information.
536 /// @{
537
538 /// Check if it is possible for execution of the specified basic block to
539 /// modify the location Loc.
540 bool canBasicBlockModify(const BasicBlock &BB, const MemoryLocation &Loc);
541
542 /// A convenience wrapper synthesizing a memory location.
543 bool canBasicBlockModify(const BasicBlock &BB, const Value *P,
546 }
547
548 /// Check if it is possible for the execution of the specified instructions
549 /// to mod\ref (according to the mode) the location Loc.
550 ///
551 /// The instructions to consider are all of the instructions in the range of
552 /// [I1,I2] INCLUSIVE. I1 and I2 must be in the same basic block.
553 bool canInstructionRangeModRef(const Instruction &I1, const Instruction &I2,
554 const MemoryLocation &Loc,
555 const ModRefInfo Mode);
556
557 /// A convenience wrapper synthesizing a memory location.
559 const Value *Ptr, LocationSize Size,
560 const ModRefInfo Mode) {
562 }
563
564 // CtxI can be nullptr, in which case the query is whether or not the aliasing
565 // relationship holds through the entire function.
566 AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB,
567 AAQueryInfo &AAQI, const Instruction *CtxI = nullptr);
568
570 bool IgnoreLocals = false);
571 ModRefInfo getModRefInfo(const Instruction *I, const CallBase *Call2,
572 AAQueryInfo &AAQIP);
573 ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc,
574 AAQueryInfo &AAQI);
575 ModRefInfo getModRefInfo(const CallBase *Call1, const CallBase *Call2,
576 AAQueryInfo &AAQI);
578 AAQueryInfo &AAQI);
579 ModRefInfo getModRefInfo(const LoadInst *L, const MemoryLocation &Loc,
580 AAQueryInfo &AAQI);
582 AAQueryInfo &AAQI);
584 AAQueryInfo &AAQI);
586 const MemoryLocation &Loc, AAQueryInfo &AAQI);
588 AAQueryInfo &AAQI);
590 AAQueryInfo &AAQI);
592 AAQueryInfo &AAQI);
594 const std::optional<MemoryLocation> &OptLoc,
595 AAQueryInfo &AAQIP);
597 const MemoryLocation &MemLoc, DominatorTree *DT,
598 AAQueryInfo &AAQIP);
600
601private:
602 class Concept;
603
604 template <typename T> class Model;
605
606 friend class AAResultBase;
607
608 const TargetLibraryInfo &TLI;
609
610 std::vector<std::unique_ptr<Concept>> AAs;
611
612 std::vector<AnalysisKey *> AADeps;
613
614 friend class BatchAAResults;
615};
616
617/// This class is a wrapper over an AAResults, and it is intended to be used
618/// only when there are no IR changes inbetween queries. BatchAAResults is
619/// reusing the same `AAQueryInfo` to preserve the state across queries,
620/// esentially making AA work in "batch mode". The internal state cannot be
621/// cleared, so to go "out-of-batch-mode", the user must either use AAResults,
622/// or create a new BatchAAResults.
624 AAResults &AA;
625 AAQueryInfo AAQI;
626 SimpleCaptureInfo SimpleCI;
627
628public:
629 BatchAAResults(AAResults &AAR) : AA(AAR), AAQI(AAR, &SimpleCI) {}
630 BatchAAResults(AAResults &AAR, CaptureInfo *CI) : AA(AAR), AAQI(AAR, CI) {}
631
632 AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
633 return AA.alias(LocA, LocB, AAQI);
634 }
635 bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal = false) {
636 return isNoModRef(AA.getModRefInfoMask(Loc, AAQI, OrLocal));
637 }
639 bool IgnoreLocals = false) {
640 return AA.getModRefInfoMask(Loc, AAQI, IgnoreLocals);
641 }
643 const std::optional<MemoryLocation> &OptLoc) {
644 return AA.getModRefInfo(I, OptLoc, AAQI);
645 }
647 return AA.getModRefInfo(I, Call2, AAQI);
648 }
649 ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx) {
650 return AA.getArgModRefInfo(Call, ArgIdx);
651 }
653 return AA.getMemoryEffects(Call, AAQI);
654 }
655 bool isMustAlias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
656 return alias(LocA, LocB) == AliasResult::MustAlias;
657 }
658 bool isMustAlias(const Value *V1, const Value *V2) {
662 }
664 const MemoryLocation &MemLoc,
665 DominatorTree *DT) {
666 return AA.callCapturesBefore(I, MemLoc, DT, AAQI);
667 }
668
669 /// Assume that values may come from different cycle iterations.
671 AAQI.MayBeCrossIteration = true;
672 }
673
674 /// Disable the use of the dominator tree during alias analysis queries.
675 void disableDominatorTree() { AAQI.UseDominatorTree = false; }
676};
677
678/// Temporary typedef for legacy code that uses a generic \c AliasAnalysis
679/// pointer or reference.
681
682/// A private abstract base class describing the concept of an individual alias
683/// analysis implementation.
684///
685/// This interface is implemented by any \c Model instantiation. It is also the
686/// interface which a type used to instantiate the model must provide.
687///
688/// All of these methods model methods by the same name in the \c
689/// AAResults class. Only differences and specifics to how the
690/// implementations are called are documented here.
692public:
693 virtual ~Concept() = 0;
694
695 //===--------------------------------------------------------------------===//
696 /// \name Alias Queries
697 /// @{
698
699 /// The main low level interface to the alias analysis implementation.
700 /// Returns an AliasResult indicating whether the two pointers are aliased to
701 /// each other. This is the interface that must be implemented by specific
702 /// alias analysis implementations.
703 virtual AliasResult alias(const MemoryLocation &LocA,
704 const MemoryLocation &LocB, AAQueryInfo &AAQI,
705 const Instruction *CtxI) = 0;
706
707 /// @}
708 //===--------------------------------------------------------------------===//
709 /// \name Simple mod/ref information
710 /// @{
711
712 /// Returns a bitmask that should be unconditionally applied to the ModRef
713 /// info of a memory location. This allows us to eliminate Mod and/or Ref from
714 /// the ModRef info based on the knowledge that the memory location points to
715 /// constant and/or locally-invariant memory.
717 AAQueryInfo &AAQI,
718 bool IgnoreLocals) = 0;
719
720 /// Get the ModRef info associated with a pointer argument of a callsite. The
721 /// result's bits are set to indicate the allowed aliasing ModRef kinds. Note
722 /// that these bits do not necessarily account for the overall behavior of
723 /// the function, but rather only provide additional per-argument
724 /// information.
726 unsigned ArgIdx) = 0;
727
728 /// Return the behavior of the given call site.
730 AAQueryInfo &AAQI) = 0;
731
732 /// Return the behavior when calling the given function.
734
735 /// getModRefInfo (for call sites) - Return information about whether
736 /// a particular call site modifies or reads the specified memory location.
737 virtual ModRefInfo getModRefInfo(const CallBase *Call,
738 const MemoryLocation &Loc,
739 AAQueryInfo &AAQI) = 0;
740
741 /// Return information about whether two call sites may refer to the same set
742 /// of memory locations. See the AA documentation for details:
743 /// http://llvm.org/docs/AliasAnalysis.html#ModRefInfo
744 virtual ModRefInfo getModRefInfo(const CallBase *Call1, const CallBase *Call2,
745 AAQueryInfo &AAQI) = 0;
746
747 /// @}
748};
749
750/// A private class template which derives from \c Concept and wraps some other
751/// type.
752///
753/// This models the concept by directly forwarding each interface point to the
754/// wrapped type which must implement a compatible interface. This provides
755/// a type erased binding.
756template <typename AAResultT> class AAResults::Model final : public Concept {
757 AAResultT &Result;
758
759public:
760 explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {}
761 ~Model() override = default;
762
763 AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB,
764 AAQueryInfo &AAQI, const Instruction *CtxI) override {
765 return Result.alias(LocA, LocB, AAQI, CtxI);
766 }
767
768 ModRefInfo getModRefInfoMask(const MemoryLocation &Loc, AAQueryInfo &AAQI,
769 bool IgnoreLocals) override {
770 return Result.getModRefInfoMask(Loc, AAQI, IgnoreLocals);
771 }
772
773 ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx) override {
774 return Result.getArgModRefInfo(Call, ArgIdx);
775 }
776
777 MemoryEffects getMemoryEffects(const CallBase *Call,
778 AAQueryInfo &AAQI) override {
779 return Result.getMemoryEffects(Call, AAQI);
780 }
781
782 MemoryEffects getMemoryEffects(const Function *F) override {
783 return Result.getMemoryEffects(F);
784 }
785
786 ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc,
787 AAQueryInfo &AAQI) override {
788 return Result.getModRefInfo(Call, Loc, AAQI);
789 }
790
791 ModRefInfo getModRefInfo(const CallBase *Call1, const CallBase *Call2,
792 AAQueryInfo &AAQI) override {
793 return Result.getModRefInfo(Call1, Call2, AAQI);
794 }
795};
796
797/// A base class to help implement the function alias analysis results concept.
798///
799/// Because of the nature of many alias analysis implementations, they often
800/// only implement a subset of the interface. This base class will attempt to
801/// implement the remaining portions of the interface in terms of simpler forms
802/// of the interface where possible, and otherwise provide conservatively
803/// correct fallback implementations.
804///
805/// Implementors of an alias analysis should derive from this class, and then
806/// override specific methods that they wish to customize. There is no need to
807/// use virtual anywhere.
809protected:
810 explicit AAResultBase() = default;
811
812 // Provide all the copy and move constructors so that derived types aren't
813 // constrained.
816
817public:
819 AAQueryInfo &AAQI, const Instruction *I) {
821 }
822
824 bool IgnoreLocals) {
825 return ModRefInfo::ModRef;
826 }
827
828 ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx) {
829 return ModRefInfo::ModRef;
830 }
831
833 return MemoryEffects::unknown();
834 }
835
837 return MemoryEffects::unknown();
838 }
839
841 AAQueryInfo &AAQI) {
842 return ModRefInfo::ModRef;
843 }
844
845 ModRefInfo getModRefInfo(const CallBase *Call1, const CallBase *Call2,
846 AAQueryInfo &AAQI) {
847 return ModRefInfo::ModRef;
848 }
849};
850
851/// Return true if this pointer is returned by a noalias function.
852bool isNoAliasCall(const Value *V);
853
854/// Return true if this pointer refers to a distinct and identifiable object.
855/// This returns true for:
856/// Global Variables and Functions (but not Global Aliases)
857/// Allocas
858/// ByVal and NoAlias Arguments
859/// NoAlias returns (e.g. calls to malloc)
860///
861bool isIdentifiedObject(const Value *V);
862
863/// Return true if V is umabigously identified at the function-level.
864/// Different IdentifiedFunctionLocals can't alias.
865/// Further, an IdentifiedFunctionLocal can not alias with any function
866/// arguments other than itself, which is not necessarily true for
867/// IdentifiedObjects.
868bool isIdentifiedFunctionLocal(const Value *V);
869
870/// Returns true if the pointer is one which would have been considered an
871/// escape by isNonEscapingLocalObject.
872bool isEscapeSource(const Value *V);
873
874/// Return true if Object memory is not visible after an unwind, in the sense
875/// that program semantics cannot depend on Object containing any particular
876/// value on unwind. If the RequiresNoCaptureBeforeUnwind out parameter is set
877/// to true, then the memory is only not visible if the object has not been
878/// captured prior to the unwind. Otherwise it is not visible even if captured.
879bool isNotVisibleOnUnwind(const Value *Object,
880 bool &RequiresNoCaptureBeforeUnwind);
881
882/// Return true if the Object is writable, in the sense that any location based
883/// on this pointer that can be loaded can also be stored to without trapping.
884/// Additionally, at the point Object is declared, stores can be introduced
885/// without data races. At later points, this is only the case if the pointer
886/// can not escape to a different thread.
887///
888/// If ExplicitlyDereferenceableOnly is set to true, this property only holds
889/// for the part of Object that is explicitly marked as dereferenceable, e.g.
890/// using the dereferenceable(N) attribute. It does not necessarily hold for
891/// parts that are only known to be dereferenceable due to the presence of
892/// loads.
893bool isWritableObject(const Value *Object, bool &ExplicitlyDereferenceableOnly);
894
895/// A manager for alias analyses.
896///
897/// This class can have analyses registered with it and when run, it will run
898/// all of them and aggregate their results into single AA results interface
899/// that dispatches across all of the alias analysis results available.
900///
901/// Note that the order in which analyses are registered is very significant.
902/// That is the order in which the results will be aggregated and queried.
903///
904/// This manager effectively wraps the AnalysisManager for registering alias
905/// analyses. When you register your alias analysis with this manager, it will
906/// ensure the analysis itself is registered with its AnalysisManager.
907///
908/// The result of this analysis is only invalidated if one of the particular
909/// aggregated AA results end up being invalidated. This removes the need to
910/// explicitly preserve the results of `AAManager`. Note that analyses should no
911/// longer be registered once the `AAManager` is run.
912class AAManager : public AnalysisInfoMixin<AAManager> {
913public:
915
916 /// Register a specific AA result.
917 template <typename AnalysisT> void registerFunctionAnalysis() {
918 ResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>);
919 }
920
921 /// Register a specific AA result.
922 template <typename AnalysisT> void registerModuleAnalysis() {
923 ResultGetters.push_back(&getModuleAAResultImpl<AnalysisT>);
924 }
925
927
928private:
930
931 static AnalysisKey Key;
932
935 4> ResultGetters;
936
937 template <typename AnalysisT>
938 static void getFunctionAAResultImpl(Function &F,
941 AAResults.addAAResult(AM.template getResult<AnalysisT>(F));
942 AAResults.addAADependencyID(AnalysisT::ID());
943 }
944
945 template <typename AnalysisT>
946 static void getModuleAAResultImpl(Function &F, FunctionAnalysisManager &AM,
947 AAResults &AAResults) {
948 auto &MAMProxy = AM.getResult<ModuleAnalysisManagerFunctionProxy>(F);
949 if (auto *R =
950 MAMProxy.template getCachedResult<AnalysisT>(*F.getParent())) {
951 AAResults.addAAResult(*R);
952 MAMProxy
953 .template registerOuterAnalysisInvalidation<AnalysisT, AAManager>();
954 }
955 }
956};
957
958/// A wrapper pass to provide the legacy pass manager access to a suitably
959/// prepared AAResults object.
961 std::unique_ptr<AAResults> AAR;
962
963public:
964 static char ID;
965
967
968 AAResults &getAAResults() { return *AAR; }
969 const AAResults &getAAResults() const { return *AAR; }
970
971 bool runOnFunction(Function &F) override;
972
973 void getAnalysisUsage(AnalysisUsage &AU) const override;
974};
975
976/// A wrapper pass for external alias analyses. This just squirrels away the
977/// callback used to run any analyses and register their results.
979 using CallbackT = std::function<void(Pass &, Function &, AAResults &)>;
980
982
983 static char ID;
984
986
988
989 void getAnalysisUsage(AnalysisUsage &AU) const override {
990 AU.setPreservesAll();
991 }
992};
993
994/// A wrapper pass around a callback which can be used to populate the
995/// AAResults in the AAResultsWrapperPass from an external AA.
996///
997/// The callback provided here will be used each time we prepare an AAResults
998/// object, and will receive a reference to the function wrapper pass, the
999/// function, and the AAResults object to populate. This should be used when
1000/// setting up a custom pass pipeline to inject a hook into the AA results.
1002 std::function<void(Pass &, Function &, AAResults &)> Callback);
1003
1004} // end namespace llvm
1005
1006#endif // LLVM_ANALYSIS_ALIASANALYSIS_H
This file defines the DenseMap class.
uint64_t Size
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
This file provides utility analysis objects describing memory locations.
#define P(N)
This header defines various interfaces for pass management in LLVM.
static cl::opt< RegAllocEvictionAdvisorAnalysis::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Development, "development", "for training")))
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
raw_pwrite_stream & OS
Provides some synthesis utilities to produce sequences of values.
This file defines the SmallVector class.
Value * RHS
Value * LHS
A manager for alias analyses.
void registerFunctionAnalysis()
Register a specific AA result.
AAResults Result
Result run(Function &F, FunctionAnalysisManager &AM)
void registerModuleAnalysis()
Register a specific AA result.
This class stores info we want to provide to or retain within an alias query.
SmallVector< AAQueryInfo::LocPair, 4 > AssumptionBasedResults
Location pairs for which an assumption based result is currently stored.
unsigned Depth
Query depth used to distinguish recursive queries.
bool UseDominatorTree
Whether alias analysis is allowed to use the dominator tree, for use by passes that lazily update the...
CaptureInfo * CI
int NumAssumptionUses
How many active NoAlias assumption uses there are.
std::pair< AACacheLoc, AACacheLoc > LocPair
AliasCacheT AliasCache
AAQueryInfo(AAResults &AAR, CaptureInfo *CI)
bool MayBeCrossIteration
Tracks whether the accesses may be on different cycle iterations.
A base class to help implement the function alias analysis results concept.
ModRefInfo getModRefInfo(const CallBase *Call1, const CallBase *Call2, AAQueryInfo &AAQI)
MemoryEffects getMemoryEffects(const CallBase *Call, AAQueryInfo &AAQI)
ModRefInfo getModRefInfoMask(const MemoryLocation &Loc, AAQueryInfo &AAQI, bool IgnoreLocals)
MemoryEffects getMemoryEffects(const Function *F)
AAResultBase(const AAResultBase &Arg)
AAResultBase(AAResultBase &&Arg)
ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc, AAQueryInfo &AAQI)
AAResultBase()=default
ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx)
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI, const Instruction *I)
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object.
const AAResults & getAAResults() const
bool runOnFunction(Function &F) override
Run the wrapper pass to rebuild an aggregation over known AA passes.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
A private abstract base class describing the concept of an individual alias analysis implementation.
virtual AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI, const Instruction *CtxI)=0
The main low level interface to the alias analysis implementation.
virtual MemoryEffects getMemoryEffects(const CallBase *Call, AAQueryInfo &AAQI)=0
Return the behavior of the given call site.
virtual ModRefInfo getModRefInfo(const CallBase *Call1, const CallBase *Call2, AAQueryInfo &AAQI)=0
Return information about whether two call sites may refer to the same set of memory locations.
virtual ModRefInfo getModRefInfoMask(const MemoryLocation &Loc, AAQueryInfo &AAQI, bool IgnoreLocals)=0
Returns a bitmask that should be unconditionally applied to the ModRef info of a memory location.
virtual ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc, AAQueryInfo &AAQI)=0
getModRefInfo (for call sites) - Return information about whether a particular call site modifies or ...
virtual ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx)=0
Get the ModRef info associated with a pointer argument of a callsite.
virtual MemoryEffects getMemoryEffects(const Function *F)=0
Return the behavior when calling the given function.
bool canInstructionRangeModRef(const Instruction &I1, const Instruction &I2, const Value *Ptr, LocationSize Size, const ModRefInfo Mode)
A convenience wrapper synthesizing a memory location.
bool pointsToConstantMemory(const Value *P, bool OrLocal=false)
A convenience wrapper around the primary pointsToConstantMemory interface.
bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal=false)
Checks whether the given location points to constant memory, or if OrLocal is true whether it points ...
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.
bool doesNotAccessMemory(const Function *F)
Checks if the specified function is known to never read or write memory.
AliasResult alias(const Value *V1, const Value *V2)
A convenience wrapper around the primary alias interface.
AliasResult alias(const Value *V1, LocationSize V1Size, const Value *V2, LocationSize V2Size)
A convenience wrapper around the primary alias interface.
bool isMustAlias(const MemoryLocation &LocA, const MemoryLocation &LocB)
A trivial helper function to check to see if the specified pointers are must-alias.
bool doesNotAccessMemory(const CallBase *Call)
Checks if the specified call is known to never read or write memory.
bool isNoAlias(const Value *V1, LocationSize V1Size, const Value *V2, LocationSize V2Size)
A convenience wrapper around the isNoAlias helper interface.
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
The main low level interface to the alias analysis implementation.
ModRefInfo getModRefInfo(const Instruction *I, const Value *P, LocationSize Size)
A convenience wrapper for constructing the memory location.
bool canBasicBlockModify(const BasicBlock &BB, const Value *P, LocationSize Size)
A convenience wrapper synthesizing a memory location.
ModRefInfo getModRefInfoMask(const MemoryLocation &Loc, bool IgnoreLocals=false)
Returns a bitmask that should be unconditionally applied to the ModRef info of a memory location.
bool isNoAlias(const Value *V1, const Value *V2)
A convenience wrapper around the isNoAlias helper interface.
bool onlyReadsMemory(const Function *F)
Checks if the specified function is known to only read from non-volatile memory (or not access memory...
ModRefInfo callCapturesBefore(const Instruction *I, const MemoryLocation &MemLoc, DominatorTree *DT)
Return information about whether a particular call site modifies or reads the specified memory locati...
MemoryEffects getMemoryEffects(const CallBase *Call)
Return the behavior of the given call site.
bool isNoAlias(const MemoryLocation &LocA, const MemoryLocation &LocB)
A trivial helper function to check to see if the specified pointers are no-alias.
ModRefInfo getModRefInfoMask(const Value *P, bool IgnoreLocals=false)
A convenience wrapper around the primary getModRefInfoMask interface.
bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &Inv)
Handle invalidation events in the new pass manager.
AAResults(const TargetLibraryInfo &TLI)
ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx)
Get the ModRef info associated with a pointer argument of a call.
bool onlyReadsMemory(const CallBase *Call)
Checks if the specified call is known to only read from non-volatile memory (or not access memory at ...
bool canInstructionRangeModRef(const Instruction &I1, const Instruction &I2, const MemoryLocation &Loc, const ModRefInfo Mode)
Check if it is possible for the execution of the specified instructions to mod(according to the mode)...
bool isMustAlias(const Value *V1, const Value *V2)
A convenience wrapper around the isMustAlias helper interface.
void addAAResult(AAResultT &AAResult)
Register a specific AA result.
void addAADependencyID(AnalysisKey *ID)
Register a function analysis ID that the results aggregation depends on.
ModRefInfo callCapturesBefore(const Instruction *I, const Value *P, LocationSize Size, DominatorTree *DT)
A convenience wrapper to synthesize a memory location.
bool canBasicBlockModify(const BasicBlock &BB, const MemoryLocation &Loc)
Check if it is possible for execution of the specified basic block to modify the location Loc.
The possible results of an alias query.
Definition: AliasAnalysis.h:81
constexpr AliasResult(const Kind &Alias)
bool operator==(const AliasResult &Other) const
bool operator!=(Kind K) const
AliasResult()=delete
void swap(bool DoSwap=true)
Helper for processing AliasResult for swapped memory location pairs.
bool operator==(Kind K) const
@ MayAlias
The two locations may or may not alias.
@ NoAlias
The two locations do not alias at all.
Definition: AliasAnalysis.h:99
@ PartialAlias
The two locations alias, but only due to a partial overlap.
@ MustAlias
The two locations precisely alias each other.
void setOffset(int32_t NewOffset)
bool operator!=(const AliasResult &Other) const
constexpr int32_t getOffset() const
constexpr bool hasOffset() const
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:387
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:348
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
An instruction that atomically checks whether a specified value is in a memory location,...
Definition: Instructions.h:522
an instruction that atomically reads a memory location, combines it with another value,...
Definition: Instructions.h:727
LLVM Basic Block Representation.
Definition: BasicBlock.h:60
This class is a wrapper over an AAResults, and it is intended to be used only when there are no IR ch...
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
BatchAAResults(AAResults &AAR)
ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx)
void disableDominatorTree()
Disable the use of the dominator tree during alias analysis queries.
BatchAAResults(AAResults &AAR, CaptureInfo *CI)
void enableCrossIterationMode()
Assume that values may come from different cycle iterations.
bool isMustAlias(const MemoryLocation &LocA, const MemoryLocation &LocB)
ModRefInfo getModRefInfo(const Instruction *I, const CallBase *Call2)
bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal=false)
MemoryEffects getMemoryEffects(const CallBase *Call)
bool isMustAlias(const Value *V1, const Value *V2)
ModRefInfo getModRefInfo(const Instruction *I, const std::optional< MemoryLocation > &OptLoc)
ModRefInfo getModRefInfoMask(const MemoryLocation &Loc, bool IgnoreLocals=false)
ModRefInfo callCapturesBefore(const Instruction *I, const MemoryLocation &MemLoc, DominatorTree *DT)
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1259
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: Dominators.h:162
Context-sensitive CaptureInfo provider, which computes and caches the earliest common dominator closu...
bool isNotCapturedBefore(const Value *Object, const Instruction *I, bool OrAt) override
Check whether Object is not captured before instruction I.
EarliestEscapeInfo(DominatorTree &DT, const LoopInfo *LI=nullptr)
void removeInstruction(Instruction *I)
An instruction for ordering other memory operations.
Definition: Instructions.h:445
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:311
ImmutablePass class - This class is used to provide information that does not need to be run.
Definition: Pass.h:282
An instruction for reading from memory.
Definition: Instructions.h:178
static LocationSize precise(uint64_t Value)
bool doesNotAccessMemory() const
Whether this function accesses no memory.
Definition: ModRef.h:192
bool onlyReadsMemory() const
Whether this function only (at most) reads memory.
Definition: ModRef.h:195
static MemoryEffectsBase unknown()
Create MemoryEffectsBase that can read and write any memory.
Definition: ModRef.h:112
Representation for a specific memory location.
static MemoryLocation getBeforeOrAfter(const Value *Ptr, const AAMDNodes &AATags=AAMDNodes())
Return a location that may access any location before or after Ptr, while remaining within the underl...
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:94
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:109
AAQueryInfo that uses SimpleCaptureInfo.
SimpleAAQueryInfo(AAResults &AAR)
Context-free CaptureInfo provider, which computes and caches whether an object is captured in the fun...
bool isNotCapturedBefore(const Value *Object, const Instruction *I, bool OrAt) override
Check whether Object is not captured before instruction I.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
An instruction for storing to memory.
Definition: Instructions.h:302
Provides information about what library functions are available for the current target.
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
LLVM Value Representation.
Definition: Value.h:74
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:71
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
bool isNoAliasCall(const Value *V)
Return true if this pointer is returned by a noalias function.
OuterAnalysisManagerProxy< ModuleAnalysisManager, Function > ModuleAnalysisManagerFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
Definition: PassManager.h:893
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
Definition: PassManager.h:637
MemoryEffectsBase< IRMemLocation > MemoryEffects
Summary of how a function affects memory in the program.
Definition: ModRef.h:268
bool isNotVisibleOnUnwind(const Value *Object, bool &RequiresNoCaptureBeforeUnwind)
Return true if Object memory is not visible after an unwind, in the sense that program semantics cann...
ModRefInfo
Flags indicating whether a memory access modifies or references memory.
Definition: ModRef.h:27
@ ModRef
The access may reference and may modify the value stored in memory.
@ Other
Any other memory.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:293
bool isIdentifiedFunctionLocal(const Value *V)
Return true if V is umabigously identified at the function-level.
bool isEscapeSource(const Value *V)
Returns true if the pointer is one which would have been considered an escape by isNonEscapingLocalOb...
ImmutablePass * createExternalAAWrapperPass(std::function< void(Pass &, Function &, AAResults &)> Callback)
A wrapper pass around a callback which can be used to populate the AAResults in the AAResultsWrapperP...
bool isNoModRef(const ModRefInfo MRI)
Definition: ModRef.h:39
bool isIdentifiedObject(const Value *V)
Return true if this pointer refers to a distinct and identifiable object.
bool isWritableObject(const Value *Object, bool &ExplicitlyDereferenceableOnly)
Return true if the Object is writable, in the sense that any location based on this pointer that can ...
Cache key for BasicAA results.
AACacheLoc(const Value *Ptr, LocationSize Size, bool MayBeCrossIteration)
LocationSize Size
AACacheLoc(PtrTy Ptr, LocationSize Size)
bool isDefinitive() const
Whether this is a definitive (non-assumption) result.
int NumAssumptionUses
Number of times a NoAlias assumption has been used.
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:114
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: Analysis.h:26
Virtual base class for providers of capture information.
virtual bool isNotCapturedBefore(const Value *Object, const Instruction *I, bool OrAt)=0
Check whether Object is not captured before instruction I.
virtual ~CaptureInfo()=0
static AACacheLoc getEmptyKey()
static bool isEqual(const AACacheLoc &LHS, const AACacheLoc &RHS)
static unsigned getHashValue(const AACacheLoc &Val)
static AACacheLoc getTombstoneKey()
An information struct used to provide DenseMap with the various necessary components for a given valu...
Definition: DenseMapInfo.h:50
A wrapper pass for external alias analyses.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
std::function< void(Pass &, Function &, AAResults &)> CallbackT