Coverage Report

Created: 2018-07-12 09:57

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/Analysis/AliasAnalysis.h
Line
Count
Source (jump to first uncovered line)
1
//===- llvm/Analysis/AliasAnalysis.h - Alias Analysis Interface -*- C++ -*-===//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
//
10
// This file defines the generic AliasAnalysis interface, which is used as the
11
// common interface used by all clients of alias analysis information, and
12
// implemented by all alias analysis implementations.  Mod/Ref information is
13
// also captured by this interface.
14
//
15
// Implementations of this interface must implement the various virtual methods,
16
// which automatically provides functionality for the entire suite of client
17
// APIs.
18
//
19
// This API identifies memory regions with the MemoryLocation class. The pointer
20
// component specifies the base memory address of the region. The Size specifies
21
// the maximum size (in address units) of the memory region, or
22
// MemoryLocation::UnknownSize if the size is not known. The TBAA tag
23
// identifies the "type" of the memory reference; see the
24
// TypeBasedAliasAnalysis class for details.
25
//
26
// Some non-obvious details include:
27
//  - Pointers that point to two completely different objects in memory never
28
//    alias, regardless of the value of the Size component.
29
//  - NoAlias doesn't imply inequal pointers. The most obvious example of this
30
//    is two pointers to constant memory. Even if they are equal, constant
31
//    memory is never stored to, so there will never be any dependencies.
32
//    In this and other situations, the pointers may be both NoAlias and
33
//    MustAlias at the same time. The current API can only return one result,
34
//    though this is rarely a problem in practice.
35
//
36
//===----------------------------------------------------------------------===//
37
38
#ifndef LLVM_ANALYSIS_ALIASANALYSIS_H
39
#define LLVM_ANALYSIS_ALIASANALYSIS_H
40
41
#include "llvm/ADT/None.h"
42
#include "llvm/ADT/Optional.h"
43
#include "llvm/ADT/SmallVector.h"
44
#include "llvm/Analysis/MemoryLocation.h"
45
#include "llvm/Analysis/TargetLibraryInfo.h"
46
#include "llvm/IR/CallSite.h"
47
#include "llvm/IR/Function.h"
48
#include "llvm/IR/Instruction.h"
49
#include "llvm/IR/Instructions.h"
50
#include "llvm/IR/PassManager.h"
51
#include "llvm/Pass.h"
52
#include <cstdint>
53
#include <functional>
54
#include <memory>
55
#include <vector>
56
57
namespace llvm {
58
59
class AnalysisUsage;
60
class BasicAAResult;
61
class BasicBlock;
62
class DominatorTree;
63
class OrderedBasicBlock;
64
class Value;
65
66
/// The possible results of an alias query.
67
///
68
/// These results are always computed between two MemoryLocation objects as
69
/// a query to some alias analysis.
70
///
71
/// Note that these are unscoped enumerations because we would like to support
72
/// implicitly testing a result for the existence of any possible aliasing with
73
/// a conversion to bool, but an "enum class" doesn't support this. The
74
/// canonical names from the literature are suffixed and unique anyways, and so
75
/// they serve as global constants in LLVM for these results.
76
///
77
/// See docs/AliasAnalysis.html for more information on the specific meanings
78
/// of these values.
79
enum AliasResult : uint8_t {
80
  /// The two locations do not alias at all.
81
  ///
82
  /// This value is arranged to convert to false, while all other values
83
  /// convert to true. This allows a boolean context to convert the result to
84
  /// a binary flag indicating whether there is the possibility of aliasing.
85
  NoAlias = 0,
86
  /// The two locations may or may not alias. This is the least precise result.
87
  MayAlias,
88
  /// The two locations alias, but only due to a partial overlap.
89
  PartialAlias,
90
  /// The two locations precisely alias each other.
91
  MustAlias,
92
};
93
94
/// << operator for AliasResult.
95
raw_ostream &operator<<(raw_ostream &OS, AliasResult AR);
96
97
/// Flags indicating whether a memory access modifies or references memory.
98
///
99
/// This is no access at all, a modification, a reference, or both
100
/// a modification and a reference. These are specifically structured such that
101
/// they form a three bit matrix and bit-tests for 'mod' or 'ref' or 'must'
102
/// work with any of the possible values.
103
enum class ModRefInfo : uint8_t {
104
  /// Must is provided for completeness, but no routines will return only
105
  /// Must today. See definition of Must below.
106
  Must = 0,
107
  /// The access may reference the value stored in memory,
108
  /// a mustAlias relation was found, and no mayAlias or partialAlias found.
109
  MustRef = 1,
110
  /// The access may modify the value stored in memory,
111
  /// a mustAlias relation was found, and no mayAlias or partialAlias found.
112
  MustMod = 2,
113
  /// The access may reference, modify or both the value stored in memory,
114
  /// a mustAlias relation was found, and no mayAlias or partialAlias found.
115
  MustModRef = MustRef | MustMod,
116
  /// The access neither references nor modifies the value stored in memory.
117
  NoModRef = 4,
118
  /// The access may reference the value stored in memory.
119
  Ref = NoModRef | MustRef,
120
  /// The access may modify the value stored in memory.
121
  Mod = NoModRef | MustMod,
122
  /// The access may reference and may modify the value stored in memory.
123
  ModRef = Ref | Mod,
124
125
  /// About Must:
126
  /// Must is set in a best effort manner.
127
  /// We usually do not try our best to infer Must, instead it is merely
128
  /// another piece of "free" information that is presented when available.
129
  /// Must set means there was certainly a MustAlias found. For calls,
130
  /// where multiple arguments are checked (argmemonly), this translates to
131
  /// only MustAlias or NoAlias was found.
132
  /// Must is not set for RAR accesses, even if the two locations must
133
  /// alias. The reason is that two read accesses translate to an early return
134
  /// of NoModRef. An additional alias check to set Must may be
135
  /// expensive. Other cases may also not set Must(e.g. callCapturesBefore).
136
  /// We refer to Must being *set* when the most significant bit is *cleared*.
137
  /// Conversely we *clear* Must information by *setting* the Must bit to 1.
138
};
139
140
40.3M
LLVM_NODISCARD inline bool isNoModRef(const ModRefInfo MRI) {
141
40.3M
  return (static_cast<int>(MRI) & static_cast<int>(ModRefInfo::MustModRef)) ==
142
40.3M
         static_cast<int>(ModRefInfo::Must);
143
40.3M
}
144
24.4M
LLVM_NODISCARD inline bool isModOrRefSet(const ModRefInfo MRI) {
145
24.4M
  return static_cast<int>(MRI) & static_cast<int>(ModRefInfo::MustModRef);
146
24.4M
}
147
38.4M
LLVM_NODISCARD inline bool isModAndRefSet(const ModRefInfo MRI) {
148
38.4M
  return (static_cast<int>(MRI) & static_cast<int>(ModRefInfo::MustModRef)) ==
149
38.4M
         static_cast<int>(ModRefInfo::MustModRef);
150
38.4M
}
151
51.2M
LLVM_NODISCARD inline bool isModSet(const ModRefInfo MRI) {
152
51.2M
  return static_cast<int>(MRI) & static_cast<int>(ModRefInfo::MustMod);
153
51.2M
}
154
23.2M
LLVM_NODISCARD inline bool isRefSet(const ModRefInfo MRI) {
155
23.2M
  return static_cast<int>(MRI) & static_cast<int>(ModRefInfo::MustRef);
156
23.2M
}
157
3.79M
LLVM_NODISCARD inline bool isMustSet(const ModRefInfo MRI) {
158
3.79M
  return !(static_cast<int>(MRI) & static_cast<int>(ModRefInfo::NoModRef));
159
3.79M
}
160
161
75.2k
LLVM_NODISCARD inline ModRefInfo setMod(const ModRefInfo MRI) {
162
75.2k
  return ModRefInfo(static_cast<int>(MRI) |
163
75.2k
                    static_cast<int>(ModRefInfo::MustMod));
164
75.2k
}
165
98.1k
LLVM_NODISCARD inline ModRefInfo setRef(const ModRefInfo MRI) {
166
98.1k
  return ModRefInfo(static_cast<int>(MRI) |
167
98.1k
                    static_cast<int>(ModRefInfo::MustRef));
168
98.1k
}
169
592k
LLVM_NODISCARD inline ModRefInfo setMust(const ModRefInfo MRI) {
170
592k
  return ModRefInfo(static_cast<int>(MRI) &
171
592k
                    static_cast<int>(ModRefInfo::MustModRef));
172
592k
}
173
7.84k
LLVM_NODISCARD inline ModRefInfo setModAndRef(const ModRefInfo MRI) {
174
7.84k
  return ModRefInfo(static_cast<int>(MRI) |
175
7.84k
                    static_cast<int>(ModRefInfo::MustModRef));
176
7.84k
}
177
78.6k
LLVM_NODISCARD inline ModRefInfo clearMod(const ModRefInfo MRI) {
178
78.6k
  return ModRefInfo(static_cast<int>(MRI) & static_cast<int>(ModRefInfo::Ref));
179
78.6k
}
180
56
LLVM_NODISCARD inline ModRefInfo clearRef(const ModRefInfo MRI) {
181
56
  return ModRefInfo(static_cast<int>(MRI) & static_cast<int>(ModRefInfo::Mod));
182
56
}
183
37.7M
LLVM_NODISCARD inline ModRefInfo clearMust(const ModRefInfo MRI) {
184
37.7M
  return ModRefInfo(static_cast<int>(MRI) |
185
37.7M
                    static_cast<int>(ModRefInfo::NoModRef));
186
37.7M
}
187
LLVM_NODISCARD inline ModRefInfo unionModRef(const ModRefInfo MRI1,
188
905k
                                             const ModRefInfo MRI2) {
189
905k
  return ModRefInfo(static_cast<int>(MRI1) | static_cast<int>(MRI2));
190
905k
}
191
LLVM_NODISCARD inline ModRefInfo intersectModRef(const ModRefInfo MRI1,
192
46.8M
                                                 const ModRefInfo MRI2) {
193
46.8M
  return ModRefInfo(static_cast<int>(MRI1) & static_cast<int>(MRI2));
194
46.8M
}
195
196
/// The locations at which a function might access memory.
197
///
198
/// These are primarily used in conjunction with the \c AccessKind bits to
199
/// describe both the nature of access and the locations of access for a
200
/// function call.
201
enum FunctionModRefLocation {
202
  /// Base case is no access to memory.
203
  FMRL_Nowhere = 0,
204
  /// Access to memory via argument pointers.
205
  FMRL_ArgumentPointees = 8,
206
  /// Memory that is inaccessible via LLVM IR.
207
  FMRL_InaccessibleMem = 16,
208
  /// Access to any memory.
209
  FMRL_Anywhere = 32 | FMRL_InaccessibleMem | FMRL_ArgumentPointees
210
};
211
212
/// Summary of how a function affects memory in the program.
213
///
214
/// Loads from constant globals are not considered memory accesses for this
215
/// interface. Also, functions may freely modify stack space local to their
216
/// invocation without having to report it through these interfaces.
217
enum FunctionModRefBehavior {
218
  /// This function does not perform any non-local loads or stores to memory.
219
  ///
220
  /// This property corresponds to the GCC 'const' attribute.
221
  /// This property corresponds to the LLVM IR 'readnone' attribute.
222
  /// This property corresponds to the IntrNoMem LLVM intrinsic flag.
223
  FMRB_DoesNotAccessMemory =
224
      FMRL_Nowhere | static_cast<int>(ModRefInfo::NoModRef),
225
226
  /// The only memory references in this function (if it has any) are
227
  /// non-volatile loads from objects pointed to by its pointer-typed
228
  /// arguments, with arbitrary offsets.
229
  ///
230
  /// This property corresponds to the IntrReadArgMem LLVM intrinsic flag.
231
  FMRB_OnlyReadsArgumentPointees =
232
      FMRL_ArgumentPointees | static_cast<int>(ModRefInfo::Ref),
233
234
  /// The only memory references in this function (if it has any) are
235
  /// non-volatile loads and stores from objects pointed to by its
236
  /// pointer-typed arguments, with arbitrary offsets.
237
  ///
238
  /// This property corresponds to the IntrArgMemOnly LLVM intrinsic flag.
239
  FMRB_OnlyAccessesArgumentPointees =
240
      FMRL_ArgumentPointees | static_cast<int>(ModRefInfo::ModRef),
241
242
  /// The only memory references in this function (if it has any) are
243
  /// references of memory that is otherwise inaccessible via LLVM IR.
244
  ///
245
  /// This property corresponds to the LLVM IR inaccessiblememonly attribute.
246
  FMRB_OnlyAccessesInaccessibleMem =
247
      FMRL_InaccessibleMem | static_cast<int>(ModRefInfo::ModRef),
248
249
  /// The function may perform non-volatile loads and stores of objects
250
  /// pointed to by its pointer-typed arguments, with arbitrary offsets, and
251
  /// it may also perform loads and stores of memory that is otherwise
252
  /// inaccessible via LLVM IR.
253
  ///
254
  /// This property corresponds to the LLVM IR
255
  /// inaccessiblemem_or_argmemonly attribute.
256
  FMRB_OnlyAccessesInaccessibleOrArgMem = FMRL_InaccessibleMem |
257
                                          FMRL_ArgumentPointees |
258
                                          static_cast<int>(ModRefInfo::ModRef),
259
260
  /// This function does not perform any non-local stores or volatile loads,
261
  /// but may read from any memory location.
262
  ///
263
  /// This property corresponds to the GCC 'pure' attribute.
264
  /// This property corresponds to the LLVM IR 'readonly' attribute.
265
  /// This property corresponds to the IntrReadMem LLVM intrinsic flag.
266
  FMRB_OnlyReadsMemory = FMRL_Anywhere | static_cast<int>(ModRefInfo::Ref),
267
268
  // This function does not read from memory anywhere, but may write to any
269
  // memory location.
270
  //
271
  // This property corresponds to the LLVM IR 'writeonly' attribute.
272
  // This property corresponds to the IntrWriteMem LLVM intrinsic flag.
273
  FMRB_DoesNotReadMemory = FMRL_Anywhere | static_cast<int>(ModRefInfo::Mod),
274
275
  /// This indicates that the function could not be classified into one of the
276
  /// behaviors above.
277
  FMRB_UnknownModRefBehavior =
278
      FMRL_Anywhere | static_cast<int>(ModRefInfo::ModRef)
279
};
280
281
// Wrapper method strips bits significant only in FunctionModRefBehavior,
282
// to obtain a valid ModRefInfo. The benefit of using the wrapper is that if
283
// ModRefInfo enum changes, the wrapper can be updated to & with the new enum
284
// entry with all bits set to 1.
285
LLVM_NODISCARD inline ModRefInfo
286
25.0M
createModRefInfo(const FunctionModRefBehavior FMRB) {
287
25.0M
  return ModRefInfo(FMRB & static_cast<int>(ModRefInfo::ModRef));
288
25.0M
}
289
290
class AAResults {
291
public:
292
  // Make these results default constructable and movable. We have to spell
293
  // these out because MSVC won't synthesize them.
294
9.20M
  AAResults(const TargetLibraryInfo &TLI) : TLI(TLI) {}
295
  AAResults(AAResults &&Arg);
296
  ~AAResults();
297
298
  /// Register a specific AA result.
299
35.2M
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
35.2M
    // FIXME: We should use a much lighter weight system than the usual
301
35.2M
    // polymorphic pattern because we don't own AAResult. It should
302
35.2M
    // ideally involve two pointers and no separate allocation.
303
35.2M
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
35.2M
  }
void llvm::AAResults::addAAResult<llvm::AMDGPUAAResult>(llvm::AMDGPUAAResult&)
Line
Count
Source
299
125k
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
125k
    // FIXME: We should use a much lighter weight system than the usual
301
125k
    // polymorphic pattern because we don't own AAResult. It should
302
125k
    // ideally involve two pointers and no separate allocation.
303
125k
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
125k
  }
void llvm::AAResults::addAAResult<llvm::BasicAAResult>(llvm::BasicAAResult&)
Line
Count
Source
299
9.20M
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
9.20M
    // FIXME: We should use a much lighter weight system than the usual
301
9.20M
    // polymorphic pattern because we don't own AAResult. It should
302
9.20M
    // ideally involve two pointers and no separate allocation.
303
9.20M
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
9.20M
  }
void llvm::AAResults::addAAResult<llvm::ScopedNoAliasAAResult>(llvm::ScopedNoAliasAAResult&)
Line
Count
Source
299
9.15M
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
9.15M
    // FIXME: We should use a much lighter weight system than the usual
301
9.15M
    // polymorphic pattern because we don't own AAResult. It should
302
9.15M
    // ideally involve two pointers and no separate allocation.
303
9.15M
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
9.15M
  }
void llvm::AAResults::addAAResult<llvm::TypeBasedAAResult>(llvm::TypeBasedAAResult&)
Line
Count
Source
299
9.15M
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
9.15M
    // FIXME: We should use a much lighter weight system than the usual
301
9.15M
    // polymorphic pattern because we don't own AAResult. It should
302
9.15M
    // ideally involve two pointers and no separate allocation.
303
9.15M
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
9.15M
  }
void llvm::AAResults::addAAResult<llvm::objcarc::ObjCARCAAResult>(llvm::objcarc::ObjCARCAAResult&)
Line
Count
Source
299
699
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
699
    // FIXME: We should use a much lighter weight system than the usual
301
699
    // polymorphic pattern because we don't own AAResult. It should
302
699
    // ideally involve two pointers and no separate allocation.
303
699
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
699
  }
void llvm::AAResults::addAAResult<llvm::GlobalsAAResult>(llvm::GlobalsAAResult&)
Line
Count
Source
299
7.58M
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
7.58M
    // FIXME: We should use a much lighter weight system than the usual
301
7.58M
    // polymorphic pattern because we don't own AAResult. It should
302
7.58M
    // ideally involve two pointers and no separate allocation.
303
7.58M
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
7.58M
  }
void llvm::AAResults::addAAResult<llvm::SCEVAAResult>(llvm::SCEVAAResult&)
Line
Count
Source
299
13
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
13
    // FIXME: We should use a much lighter weight system than the usual
301
13
    // polymorphic pattern because we don't own AAResult. It should
302
13
    // ideally involve two pointers and no separate allocation.
303
13
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
13
  }
void llvm::AAResults::addAAResult<llvm::CFLAndersAAResult>(llvm::CFLAndersAAResult&)
Line
Count
Source
299
83
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
83
    // FIXME: We should use a much lighter weight system than the usual
301
83
    // polymorphic pattern because we don't own AAResult. It should
302
83
    // ideally involve two pointers and no separate allocation.
303
83
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
83
  }
void llvm::AAResults::addAAResult<llvm::CFLSteensAAResult>(llvm::CFLSteensAAResult&)
Line
Count
Source
299
106
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
106
    // FIXME: We should use a much lighter weight system than the usual
301
106
    // polymorphic pattern because we don't own AAResult. It should
302
106
    // ideally involve two pointers and no separate allocation.
303
106
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
106
  }
305
306
  /// Register a function analysis ID that the results aggregation depends on.
307
  ///
308
  /// This is used in the new pass manager to implement the invalidation logic
309
  /// where we must invalidate the results aggregation if any of our component
310
  /// analyses become invalid.
311
1.53k
  void addAADependencyID(AnalysisKey *ID) { AADeps.push_back(ID); }
312
313
  /// Handle invalidation events in the new pass manager.
314
  ///
315
  /// The aggregation is invalidated if any of the underlying analyses is
316
  /// invalidated.
317
  bool invalidate(Function &F, const PreservedAnalyses &PA,
318
                  FunctionAnalysisManager::Invalidator &Inv);
319
320
  //===--------------------------------------------------------------------===//
321
  /// \name Alias Queries
322
  /// @{
323
324
  /// The main low level interface to the alias analysis implementation.
325
  /// Returns an AliasResult indicating whether the two pointers are aliased to
326
  /// each other. This is the interface that must be implemented by specific
327
  /// alias analysis implementations.
328
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB);
329
330
  /// A convenience wrapper around the primary \c alias interface.
331
  AliasResult alias(const Value *V1, LocationSize V1Size, const Value *V2,
332
338k
                    LocationSize V2Size) {
333
338k
    return alias(MemoryLocation(V1, V1Size), MemoryLocation(V2, V2Size));
334
338k
  }
335
336
  /// A convenience wrapper around the primary \c alias interface.
337
733
  AliasResult alias(const Value *V1, const Value *V2) {
338
733
    return alias(V1, MemoryLocation::UnknownSize, V2,
339
733
                 MemoryLocation::UnknownSize);
340
733
  }
341
342
  /// A trivial helper function to check to see if the specified pointers are
343
  /// no-alias.
344
7.85k
  bool isNoAlias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
345
7.85k
    return alias(LocA, LocB) == NoAlias;
346
7.85k
  }
347
348
  /// A convenience wrapper around the \c isNoAlias helper interface.
349
  bool isNoAlias(const Value *V1, LocationSize V1Size, const Value *V2,
350
0
                 LocationSize V2Size) {
351
0
    return isNoAlias(MemoryLocation(V1, V1Size), MemoryLocation(V2, V2Size));
352
0
  }
353
354
  /// A convenience wrapper around the \c isNoAlias helper interface.
355
0
  bool isNoAlias(const Value *V1, const Value *V2) {
356
0
    return isNoAlias(MemoryLocation(V1), MemoryLocation(V2));
357
0
  }
358
359
  /// A trivial helper function to check to see if the specified pointers are
360
  /// must-alias.
361
294k
  bool isMustAlias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
362
294k
    return alias(LocA, LocB) == MustAlias;
363
294k
  }
364
365
  /// A convenience wrapper around the \c isMustAlias helper interface.
366
332k
  bool isMustAlias(const Value *V1, const Value *V2) {
367
332k
    return alias(V1, 1, V2, 1) == MustAlias;
368
332k
  }
369
370
  /// Checks whether the given location points to constant memory, or if
371
  /// \p OrLocal is true whether it points to a local alloca.
372
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal = false);
373
374
  /// A convenience wrapper around the primary \c pointsToConstantMemory
375
  /// interface.
376
2.80M
  bool pointsToConstantMemory(const Value *P, bool OrLocal = false) {
377
2.80M
    return pointsToConstantMemory(MemoryLocation(P), OrLocal);
378
2.80M
  }
379
380
  /// @}
381
  //===--------------------------------------------------------------------===//
382
  /// \name Simple mod/ref information
383
  /// @{
384
385
  /// Get the ModRef info associated with a pointer argument of a callsite. The
386
  /// result's bits are set to indicate the allowed aliasing ModRef kinds. Note
387
  /// that these bits do not necessarily account for the overall behavior of
388
  /// the function, but rather only provide additional per-argument
389
  /// information. This never sets ModRefInfo::Must.
390
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx);
391
392
  /// Return the behavior of the given call site.
393
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS);
394
395
  /// Return the behavior when calling the given function.
396
  FunctionModRefBehavior getModRefBehavior(const Function *F);
397
398
  /// Checks if the specified call is known to never read or write memory.
399
  ///
400
  /// Note that if the call only reads from known-constant memory, it is also
401
  /// legal to return true. Also, calls that unwind the stack are legal for
402
  /// this predicate.
403
  ///
404
  /// Many optimizations (such as CSE and LICM) can be performed on such calls
405
  /// without worrying about aliasing properties, and many calls have this
406
  /// property (e.g. calls to 'sin' and 'cos').
407
  ///
408
  /// This property corresponds to the GCC 'const' attribute.
409
1.75M
  bool doesNotAccessMemory(ImmutableCallSite CS) {
410
1.75M
    return getModRefBehavior(CS) == FMRB_DoesNotAccessMemory;
411
1.75M
  }
412
413
  /// Checks if the specified function is known to never read or write memory.
414
  ///
415
  /// Note that if the function only reads from known-constant memory, it is
416
  /// also legal to return true. Also, function that unwind the stack are legal
417
  /// for this predicate.
418
  ///
419
  /// Many optimizations (such as CSE and LICM) can be performed on such calls
420
  /// to such functions without worrying about aliasing properties, and many
421
  /// functions have this property (e.g. 'sin' and 'cos').
422
  ///
423
  /// This property corresponds to the GCC 'const' attribute.
424
0
  bool doesNotAccessMemory(const Function *F) {
425
0
    return getModRefBehavior(F) == FMRB_DoesNotAccessMemory;
426
0
  }
427
428
  /// Checks if the specified call is known to only read from non-volatile
429
  /// memory (or not access memory at all).
430
  ///
431
  /// Calls that unwind the stack are legal for this predicate.
432
  ///
433
  /// This property allows many common optimizations to be performed in the
434
  /// absence of interfering store instructions, such as CSE of strlen calls.
435
  ///
436
  /// This property corresponds to the GCC 'pure' attribute.
437
1.53M
  bool onlyReadsMemory(ImmutableCallSite CS) {
438
1.53M
    return onlyReadsMemory(getModRefBehavior(CS));
439
1.53M
  }
440
441
  /// Checks if the specified function is known to only read from non-volatile
442
  /// memory (or not access memory at all).
443
  ///
444
  /// Functions that unwind the stack are legal for this predicate.
445
  ///
446
  /// This property allows many common optimizations to be performed in the
447
  /// absence of interfering store instructions, such as CSE of strlen calls.
448
  ///
449
  /// This property corresponds to the GCC 'pure' attribute.
450
0
  bool onlyReadsMemory(const Function *F) {
451
0
    return onlyReadsMemory(getModRefBehavior(F));
452
0
  }
453
454
  /// Checks if functions with the specified behavior are known to only read
455
  /// from non-volatile memory (or not access memory at all).
456
12.8M
  static bool onlyReadsMemory(FunctionModRefBehavior MRB) {
457
12.8M
    return !isModSet(createModRefInfo(MRB));
458
12.8M
  }
459
460
  /// Checks if functions with the specified behavior are known to only write
461
  /// memory (or not access memory at all).
462
8.56M
  static bool doesNotReadMemory(FunctionModRefBehavior MRB) {
463
8.56M
    return !isRefSet(createModRefInfo(MRB));
464
8.56M
  }
465
466
  /// Checks if functions with the specified behavior are known to read and
467
  /// write at most from objects pointed to by their pointer-typed arguments
468
  /// (with arbitrary offsets).
469
9.88M
  static bool onlyAccessesArgPointees(FunctionModRefBehavior MRB) {
470
9.88M
    return !(MRB & FMRL_Anywhere & ~FMRL_ArgumentPointees);
471
9.88M
  }
472
473
  /// Checks if functions with the specified behavior are known to potentially
474
  /// read or write from objects pointed to be their pointer-typed arguments
475
  /// (with arbitrary offsets).
476
1.74M
  static bool doesAccessArgPointees(FunctionModRefBehavior MRB) {
477
1.74M
    return isModOrRefSet(createModRefInfo(MRB)) &&
478
1.74M
           (MRB & FMRL_ArgumentPointees);
479
1.74M
  }
480
481
  /// Checks if functions with the specified behavior are known to read and
482
  /// write at most from memory that is inaccessible from LLVM IR.
483
0
  static bool onlyAccessesInaccessibleMem(FunctionModRefBehavior MRB) {
484
0
    return !(MRB & FMRL_Anywhere & ~FMRL_InaccessibleMem);
485
0
  }
486
487
  /// Checks if functions with the specified behavior are known to potentially
488
  /// read or write from memory that is inaccessible from LLVM IR.
489
0
  static bool doesAccessInaccessibleMem(FunctionModRefBehavior MRB) {
490
0
    return isModOrRefSet(createModRefInfo(MRB)) && (MRB & FMRL_InaccessibleMem);
491
0
  }
492
493
  /// Checks if functions with the specified behavior are known to read and
494
  /// write at most from memory that is inaccessible from LLVM IR or objects
495
  /// pointed to by their pointer-typed arguments (with arbitrary offsets).
496
5.85M
  static bool onlyAccessesInaccessibleOrArgMem(FunctionModRefBehavior MRB) {
497
5.85M
    return !(MRB & FMRL_Anywhere &
498
5.85M
             ~(FMRL_InaccessibleMem | FMRL_ArgumentPointees));
499
5.85M
  }
500
501
  /// getModRefInfo (for call sites) - Return information about whether
502
  /// a particular call site modifies or reads the specified memory location.
503
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc);
504
505
  /// getModRefInfo (for call sites) - A convenience wrapper.
506
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const Value *P,
507
158k
                           LocationSize Size) {
508
158k
    return getModRefInfo(CS, MemoryLocation(P, Size));
509
158k
  }
510
511
  /// getModRefInfo (for calls) - Return information about whether
512
  /// a particular call modifies or reads the specified memory location.
513
7.07M
  ModRefInfo getModRefInfo(const CallInst *C, const MemoryLocation &Loc) {
514
7.07M
    return getModRefInfo(ImmutableCallSite(C), Loc);
515
7.07M
  }
516
517
  /// getModRefInfo (for calls) - A convenience wrapper.
518
  ModRefInfo getModRefInfo(const CallInst *C, const Value *P,
519
123
                           LocationSize Size) {
520
123
    return getModRefInfo(C, MemoryLocation(P, Size));
521
123
  }
522
523
  /// getModRefInfo (for invokes) - Return information about whether
524
  /// a particular invoke modifies or reads the specified memory location.
525
207k
  ModRefInfo getModRefInfo(const InvokeInst *I, const MemoryLocation &Loc) {
526
207k
    return getModRefInfo(ImmutableCallSite(I), Loc);
527
207k
  }
528
529
  /// getModRefInfo (for invokes) - A convenience wrapper.
530
  ModRefInfo getModRefInfo(const InvokeInst *I, const Value *P,
531
0
                           LocationSize Size) {
532
0
    return getModRefInfo(I, MemoryLocation(P, Size));
533
0
  }
534
535
  /// getModRefInfo (for loads) - Return information about whether
536
  /// a particular load modifies or reads the specified memory location.
537
  ModRefInfo getModRefInfo(const LoadInst *L, const MemoryLocation &Loc);
538
539
  /// getModRefInfo (for loads) - A convenience wrapper.
540
  ModRefInfo getModRefInfo(const LoadInst *L, const Value *P,
541
0
                           LocationSize Size) {
542
0
    return getModRefInfo(L, MemoryLocation(P, Size));
543
0
  }
544
545
  /// getModRefInfo (for stores) - Return information about whether
546
  /// a particular store modifies or reads the specified memory location.
547
  ModRefInfo getModRefInfo(const StoreInst *S, const MemoryLocation &Loc);
548
549
  /// getModRefInfo (for stores) - A convenience wrapper.
550
  ModRefInfo getModRefInfo(const StoreInst *S, const Value *P,
551
2.60M
                           LocationSize Size) {
552
2.60M
    return getModRefInfo(S, MemoryLocation(P, Size));
553
2.60M
  }
554
555
  /// getModRefInfo (for fences) - Return information about whether
556
  /// a particular store modifies or reads the specified memory location.
557
  ModRefInfo getModRefInfo(const FenceInst *S, const MemoryLocation &Loc);
558
559
  /// getModRefInfo (for fences) - A convenience wrapper.
560
  ModRefInfo getModRefInfo(const FenceInst *S, const Value *P,
561
0
                           LocationSize Size) {
562
0
    return getModRefInfo(S, MemoryLocation(P, Size));
563
0
  }
564
565
  /// getModRefInfo (for cmpxchges) - Return information about whether
566
  /// a particular cmpxchg modifies or reads the specified memory location.
567
  ModRefInfo getModRefInfo(const AtomicCmpXchgInst *CX,
568
                           const MemoryLocation &Loc);
569
570
  /// getModRefInfo (for cmpxchges) - A convenience wrapper.
571
  ModRefInfo getModRefInfo(const AtomicCmpXchgInst *CX, const Value *P,
572
0
                           unsigned Size) {
573
0
    return getModRefInfo(CX, MemoryLocation(P, Size));
574
0
  }
575
576
  /// getModRefInfo (for atomicrmws) - Return information about whether
577
  /// a particular atomicrmw modifies or reads the specified memory location.
578
  ModRefInfo getModRefInfo(const AtomicRMWInst *RMW, const MemoryLocation &Loc);
579
580
  /// getModRefInfo (for atomicrmws) - A convenience wrapper.
581
  ModRefInfo getModRefInfo(const AtomicRMWInst *RMW, const Value *P,
582
0
                           unsigned Size) {
583
0
    return getModRefInfo(RMW, MemoryLocation(P, Size));
584
0
  }
585
586
  /// getModRefInfo (for va_args) - Return information about whether
587
  /// a particular va_arg modifies or reads the specified memory location.
588
  ModRefInfo getModRefInfo(const VAArgInst *I, const MemoryLocation &Loc);
589
590
  /// getModRefInfo (for va_args) - A convenience wrapper.
591
  ModRefInfo getModRefInfo(const VAArgInst *I, const Value *P,
592
0
                           LocationSize Size) {
593
0
    return getModRefInfo(I, MemoryLocation(P, Size));
594
0
  }
595
596
  /// getModRefInfo (for catchpads) - Return information about whether
597
  /// a particular catchpad modifies or reads the specified memory location.
598
  ModRefInfo getModRefInfo(const CatchPadInst *I, const MemoryLocation &Loc);
599
600
  /// getModRefInfo (for catchpads) - A convenience wrapper.
601
  ModRefInfo getModRefInfo(const CatchPadInst *I, const Value *P,
602
0
                           LocationSize Size) {
603
0
    return getModRefInfo(I, MemoryLocation(P, Size));
604
0
  }
605
606
  /// getModRefInfo (for catchrets) - Return information about whether
607
  /// a particular catchret modifies or reads the specified memory location.
608
  ModRefInfo getModRefInfo(const CatchReturnInst *I, const MemoryLocation &Loc);
609
610
  /// getModRefInfo (for catchrets) - A convenience wrapper.
611
  ModRefInfo getModRefInfo(const CatchReturnInst *I, const Value *P,
612
0
                           LocationSize Size) {
613
0
    return getModRefInfo(I, MemoryLocation(P, Size));
614
0
  }
615
616
  /// Check whether or not an instruction may read or write the optionally
617
  /// specified memory location.
618
  ///
619
  ///
620
  /// An instruction that doesn't read or write memory may be trivially LICM'd
621
  /// for example.
622
  ///
623
  /// For function calls, this delegates to the alias-analysis specific
624
  /// call-site mod-ref behavior queries. Otherwise it delegates to the specific
625
  /// helpers above.
626
  ModRefInfo getModRefInfo(const Instruction *I,
627
59.3M
                           const Optional<MemoryLocation> &OptLoc) {
628
59.3M
    if (OptLoc == None) {
629
14.3M
      if (auto CS = ImmutableCallSite(I)) {
630
1.85M
        return createModRefInfo(getModRefBehavior(CS));
631
1.85M
      }
632
57.4M
    }
633
57.4M
634
57.4M
    const MemoryLocation &Loc = OptLoc.getValueOr(MemoryLocation());
635
57.4M
636
57.4M
    switch (I->getOpcode()) {
637
57.4M
    
case Instruction::VAArg: return getModRefInfo((const VAArgInst*)I, Loc)835
;
638
57.4M
    
case Instruction::Load: return getModRefInfo((const LoadInst*)I, Loc)1.69M
;
639
57.4M
    
case Instruction::Store: return getModRefInfo((const StoreInst*)I, Loc)3.46M
;
640
57.4M
    
case Instruction::Fence: return getModRefInfo((const FenceInst*)I, Loc)31.6k
;
641
57.4M
    case Instruction::AtomicCmpXchg:
642
27.8k
      return getModRefInfo((const AtomicCmpXchgInst*)I, Loc);
643
57.4M
    case Instruction::AtomicRMW:
644
112k
      return getModRefInfo((const AtomicRMWInst*)I, Loc);
645
57.4M
    
case Instruction::Call: return getModRefInfo((const CallInst*)I, Loc)7.07M
;
646
57.4M
    
case Instruction::Invoke: return getModRefInfo((const InvokeInst*)I,Loc)207k
;
647
57.4M
    case Instruction::CatchPad:
648
2
      return getModRefInfo((const CatchPadInst *)I, Loc);
649
57.4M
    case Instruction::CatchRet:
650
6
      return getModRefInfo((const CatchReturnInst *)I, Loc);
651
57.4M
    default:
652
44.8M
      return ModRefInfo::NoModRef;
653
57.4M
    }
654
57.4M
  }
655
656
  /// A convenience wrapper for constructing the memory location.
657
  ModRefInfo getModRefInfo(const Instruction *I, const Value *P,
658
3.26M
                           LocationSize Size) {
659
3.26M
    return getModRefInfo(I, MemoryLocation(P, Size));
660
3.26M
  }
661
662
  /// Return information about whether a call and an instruction may refer to
663
  /// the same memory locations.
664
  ModRefInfo getModRefInfo(Instruction *I, ImmutableCallSite Call);
665
666
  /// Return information about whether two call sites may refer to the same set
667
  /// of memory locations. See the AA documentation for details:
668
  ///   http://llvm.org/docs/AliasAnalysis.html#ModRefInfo
669
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2);
670
671
  /// Return information about whether a particular call site modifies
672
  /// or reads the specified memory location \p MemLoc before instruction \p I
673
  /// in a BasicBlock. An ordered basic block \p OBB can be used to speed up
674
  /// instruction ordering queries inside the BasicBlock containing \p I.
675
  /// Early exits in callCapturesBefore may lead to ModRefInfo::Must not being
676
  /// set.
677
  ModRefInfo callCapturesBefore(const Instruction *I,
678
                                const MemoryLocation &MemLoc, DominatorTree *DT,
679
                                OrderedBasicBlock *OBB = nullptr);
680
681
  /// A convenience wrapper to synthesize a memory location.
682
  ModRefInfo callCapturesBefore(const Instruction *I, const Value *P,
683
                                LocationSize Size, DominatorTree *DT,
684
4
                                OrderedBasicBlock *OBB = nullptr) {
685
4
    return callCapturesBefore(I, MemoryLocation(P, Size), DT, OBB);
686
4
  }
687
688
  /// @}
689
  //===--------------------------------------------------------------------===//
690
  /// \name Higher level methods for querying mod/ref information.
691
  /// @{
692
693
  /// Check if it is possible for execution of the specified basic block to
694
  /// modify the location Loc.
695
  bool canBasicBlockModify(const BasicBlock &BB, const MemoryLocation &Loc);
696
697
  /// A convenience wrapper synthesizing a memory location.
698
  bool canBasicBlockModify(const BasicBlock &BB, const Value *P,
699
0
                           LocationSize Size) {
700
0
    return canBasicBlockModify(BB, MemoryLocation(P, Size));
701
0
  }
702
703
  /// Check if it is possible for the execution of the specified instructions
704
  /// to mod\ref (according to the mode) the location Loc.
705
  ///
706
  /// The instructions to consider are all of the instructions in the range of
707
  /// [I1,I2] INCLUSIVE. I1 and I2 must be in the same basic block.
708
  bool canInstructionRangeModRef(const Instruction &I1, const Instruction &I2,
709
                                 const MemoryLocation &Loc,
710
                                 const ModRefInfo Mode);
711
712
  /// A convenience wrapper synthesizing a memory location.
713
  bool canInstructionRangeModRef(const Instruction &I1, const Instruction &I2,
714
                                 const Value *Ptr, LocationSize Size,
715
0
                                 const ModRefInfo Mode) {
716
0
    return canInstructionRangeModRef(I1, I2, MemoryLocation(Ptr, Size), Mode);
717
0
  }
718
719
private:
720
  class Concept;
721
722
  template <typename T> class Model;
723
724
  template <typename T> friend class AAResultBase;
725
726
  const TargetLibraryInfo &TLI;
727
728
  std::vector<std::unique_ptr<Concept>> AAs;
729
730
  std::vector<AnalysisKey *> AADeps;
731
};
732
733
/// Temporary typedef for legacy code that uses a generic \c AliasAnalysis
734
/// pointer or reference.
735
using AliasAnalysis = AAResults;
736
737
/// A private abstract base class describing the concept of an individual alias
738
/// analysis implementation.
739
///
740
/// This interface is implemented by any \c Model instantiation. It is also the
741
/// interface which a type used to instantiate the model must provide.
742
///
743
/// All of these methods model methods by the same name in the \c
744
/// AAResults class. Only differences and specifics to how the
745
/// implementations are called are documented here.
746
class AAResults::Concept {
747
public:
748
  virtual ~Concept() = 0;
749
750
  /// An update API used internally by the AAResults to provide
751
  /// a handle back to the top level aggregation.
752
  virtual void setAAResults(AAResults *NewAAR) = 0;
753
754
  //===--------------------------------------------------------------------===//
755
  /// \name Alias Queries
756
  /// @{
757
758
  /// The main low level interface to the alias analysis implementation.
759
  /// Returns an AliasResult indicating whether the two pointers are aliased to
760
  /// each other. This is the interface that must be implemented by specific
761
  /// alias analysis implementations.
762
  virtual AliasResult alias(const MemoryLocation &LocA,
763
                            const MemoryLocation &LocB) = 0;
764
765
  /// Checks whether the given location points to constant memory, or if
766
  /// \p OrLocal is true whether it points to a local alloca.
767
  virtual bool pointsToConstantMemory(const MemoryLocation &Loc,
768
                                      bool OrLocal) = 0;
769
770
  /// @}
771
  //===--------------------------------------------------------------------===//
772
  /// \name Simple mod/ref information
773
  /// @{
774
775
  /// Get the ModRef info associated with a pointer argument of a callsite. The
776
  /// result's bits are set to indicate the allowed aliasing ModRef kinds. Note
777
  /// that these bits do not necessarily account for the overall behavior of
778
  /// the function, but rather only provide additional per-argument
779
  /// information.
780
  virtual ModRefInfo getArgModRefInfo(ImmutableCallSite CS,
781
                                      unsigned ArgIdx) = 0;
782
783
  /// Return the behavior of the given call site.
784
  virtual FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) = 0;
785
786
  /// Return the behavior when calling the given function.
787
  virtual FunctionModRefBehavior getModRefBehavior(const Function *F) = 0;
788
789
  /// getModRefInfo (for call sites) - Return information about whether
790
  /// a particular call site modifies or reads the specified memory location.
791
  virtual ModRefInfo getModRefInfo(ImmutableCallSite CS,
792
                                   const MemoryLocation &Loc) = 0;
793
794
  /// Return information about whether two call sites may refer to the same set
795
  /// of memory locations. See the AA documentation for details:
796
  ///   http://llvm.org/docs/AliasAnalysis.html#ModRefInfo
797
  virtual ModRefInfo getModRefInfo(ImmutableCallSite CS1,
798
                                   ImmutableCallSite CS2) = 0;
799
800
  /// @}
801
};
802
803
/// A private class template which derives from \c Concept and wraps some other
804
/// type.
805
///
806
/// This models the concept by directly forwarding each interface point to the
807
/// wrapped type which must implement a compatible interface. This provides
808
/// a type erased binding.
809
template <typename AAResultT> class AAResults::Model final : public Concept {
810
  AAResultT &Result;
811
812
public:
813
35.2M
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
814
35.2M
    Result.setAAResults(&AAR);
815
35.2M
  }
llvm::AAResults::Model<llvm::AMDGPUAAResult>::Model(llvm::AMDGPUAAResult&, llvm::AAResults&)
Line
Count
Source
813
125k
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
814
125k
    Result.setAAResults(&AAR);
815
125k
  }
llvm::AAResults::Model<llvm::BasicAAResult>::Model(llvm::BasicAAResult&, llvm::AAResults&)
Line
Count
Source
813
9.20M
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
814
9.20M
    Result.setAAResults(&AAR);
815
9.20M
  }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::Model(llvm::ScopedNoAliasAAResult&, llvm::AAResults&)
Line
Count
Source
813
9.15M
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
814
9.15M
    Result.setAAResults(&AAR);
815
9.15M
  }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::Model(llvm::TypeBasedAAResult&, llvm::AAResults&)
Line
Count
Source
813
9.15M
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
814
9.15M
    Result.setAAResults(&AAR);
815
9.15M
  }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::Model(llvm::objcarc::ObjCARCAAResult&, llvm::AAResults&)
Line
Count
Source
813
699
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
814
699
    Result.setAAResults(&AAR);
815
699
  }
llvm::AAResults::Model<llvm::GlobalsAAResult>::Model(llvm::GlobalsAAResult&, llvm::AAResults&)
Line
Count
Source
813
7.58M
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
814
7.58M
    Result.setAAResults(&AAR);
815
7.58M
  }
llvm::AAResults::Model<llvm::SCEVAAResult>::Model(llvm::SCEVAAResult&, llvm::AAResults&)
Line
Count
Source
813
13
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
814
13
    Result.setAAResults(&AAR);
815
13
  }
llvm::AAResults::Model<llvm::CFLAndersAAResult>::Model(llvm::CFLAndersAAResult&, llvm::AAResults&)
Line
Count
Source
813
83
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
814
83
    Result.setAAResults(&AAR);
815
83
  }
llvm::AAResults::Model<llvm::CFLSteensAAResult>::Model(llvm::CFLSteensAAResult&, llvm::AAResults&)
Line
Count
Source
813
106
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
814
106
    Result.setAAResults(&AAR);
815
106
  }
816
35.2M
  ~Model() override = default;
llvm::AAResults::Model<llvm::AMDGPUAAResult>::~Model()
Line
Count
Source
816
125k
  ~Model() override = default;
llvm::AAResults::Model<llvm::BasicAAResult>::~Model()
Line
Count
Source
816
9.20M
  ~Model() override = default;
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::~Model()
Line
Count
Source
816
9.15M
  ~Model() override = default;
llvm::AAResults::Model<llvm::TypeBasedAAResult>::~Model()
Line
Count
Source
816
9.15M
  ~Model() override = default;
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::~Model()
Line
Count
Source
816
699
  ~Model() override = default;
llvm::AAResults::Model<llvm::GlobalsAAResult>::~Model()
Line
Count
Source
816
7.58M
  ~Model() override = default;
llvm::AAResults::Model<llvm::SCEVAAResult>::~Model()
Line
Count
Source
816
13
  ~Model() override = default;
llvm::AAResults::Model<llvm::CFLAndersAAResult>::~Model()
Line
Count
Source
816
83
  ~Model() override = default;
llvm::AAResults::Model<llvm::CFLSteensAAResult>::~Model()
Line
Count
Source
816
106
  ~Model() override = default;
817
818
4.15M
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
Unexecuted instantiation: llvm::AAResults::Model<llvm::AMDGPUAAResult>::setAAResults(llvm::AAResults*)
llvm::AAResults::Model<llvm::BasicAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
818
1.05M
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
818
1.03M
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
818
1.03M
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
818
54
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
llvm::AAResults::Model<llvm::GlobalsAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
818
1.02M
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
llvm::AAResults::Model<llvm::SCEVAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
818
12
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
llvm::AAResults::Model<llvm::CFLAndersAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
818
82
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
llvm::AAResults::Model<llvm::CFLSteensAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
818
84
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
819
820
  AliasResult alias(const MemoryLocation &LocA,
821
178M
                    const MemoryLocation &LocB) override {
822
178M
    return Result.alias(LocA, LocB);
823
178M
  }
llvm::AAResults::Model<llvm::AMDGPUAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
821
71.8k
                    const MemoryLocation &LocB) override {
822
71.8k
    return Result.alias(LocA, LocB);
823
71.8k
  }
llvm::AAResults::Model<llvm::BasicAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
821
72.3M
                    const MemoryLocation &LocB) override {
822
72.3M
    return Result.alias(LocA, LocB);
823
72.3M
  }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
821
38.3M
                    const MemoryLocation &LocB) override {
822
38.3M
    return Result.alias(LocA, LocB);
823
38.3M
  }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
821
38.2M
                    const MemoryLocation &LocB) override {
822
38.2M
    return Result.alias(LocA, LocB);
823
38.2M
  }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
821
1.22k
                    const MemoryLocation &LocB) override {
822
1.22k
    return Result.alias(LocA, LocB);
823
1.22k
  }
llvm::AAResults::Model<llvm::GlobalsAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
821
29.2M
                    const MemoryLocation &LocB) override {
822
29.2M
    return Result.alias(LocA, LocB);
823
29.2M
  }
llvm::AAResults::Model<llvm::SCEVAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
821
124
                    const MemoryLocation &LocB) override {
822
124
    return Result.alias(LocA, LocB);
823
124
  }
llvm::AAResults::Model<llvm::CFLAndersAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
821
665
                    const MemoryLocation &LocB) override {
822
665
    return Result.alias(LocA, LocB);
823
665
  }
llvm::AAResults::Model<llvm::CFLSteensAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
821
2.80k
                    const MemoryLocation &LocB) override {
822
2.80k
    return Result.alias(LocA, LocB);
823
2.80k
  }
824
825
  bool pointsToConstantMemory(const MemoryLocation &Loc,
826
66.1M
                              bool OrLocal) override {
827
66.1M
    return Result.pointsToConstantMemory(Loc, OrLocal);
828
66.1M
  }
llvm::AAResults::Model<llvm::AMDGPUAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
826
81.7k
                              bool OrLocal) override {
827
81.7k
    return Result.pointsToConstantMemory(Loc, OrLocal);
828
81.7k
  }
llvm::AAResults::Model<llvm::BasicAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
826
18.5M
                              bool OrLocal) override {
827
18.5M
    return Result.pointsToConstantMemory(Loc, OrLocal);
828
18.5M
  }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
826
18.4M
                              bool OrLocal) override {
827
18.4M
    return Result.pointsToConstantMemory(Loc, OrLocal);
828
18.4M
  }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
826
18.4M
                              bool OrLocal) override {
827
18.4M
    return Result.pointsToConstantMemory(Loc, OrLocal);
828
18.4M
  }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
826
1.37k
                              bool OrLocal) override {
827
1.37k
    return Result.pointsToConstantMemory(Loc, OrLocal);
828
1.37k
  }
llvm::AAResults::Model<llvm::GlobalsAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
826
10.5M
                              bool OrLocal) override {
827
10.5M
    return Result.pointsToConstantMemory(Loc, OrLocal);
828
10.5M
  }
Unexecuted instantiation: llvm::AAResults::Model<llvm::SCEVAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
llvm::AAResults::Model<llvm::CFLAndersAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
826
252
                              bool OrLocal) override {
827
252
    return Result.pointsToConstantMemory(Loc, OrLocal);
828
252
  }
llvm::AAResults::Model<llvm::CFLSteensAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
826
298
                              bool OrLocal) override {
827
298
    return Result.pointsToConstantMemory(Loc, OrLocal);
828
298
  }
829
830
3.52M
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) override {
831
3.52M
    return Result.getArgModRefInfo(CS, ArgIdx);
832
3.52M
  }
llvm::AAResults::Model<llvm::AMDGPUAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
830
20
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) override {
831
20
    return Result.getArgModRefInfo(CS, ArgIdx);
832
20
  }
llvm::AAResults::Model<llvm::BasicAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
830
884k
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) override {
831
884k
    return Result.getArgModRefInfo(CS, ArgIdx);
832
884k
  }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
830
883k
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) override {
831
883k
    return Result.getArgModRefInfo(CS, ArgIdx);
832
883k
  }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
830
883k
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) override {
831
883k
    return Result.getArgModRefInfo(CS, ArgIdx);
832
883k
  }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
830
4
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) override {
831
4
    return Result.getArgModRefInfo(CS, ArgIdx);
832
4
  }
llvm::AAResults::Model<llvm::GlobalsAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
830
876k
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) override {
831
876k
    return Result.getArgModRefInfo(CS, ArgIdx);
832
876k
  }
Unexecuted instantiation: llvm::AAResults::Model<llvm::SCEVAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Unexecuted instantiation: llvm::AAResults::Model<llvm::CFLAndersAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Unexecuted instantiation: llvm::AAResults::Model<llvm::CFLSteensAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
833
834
63.3M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
835
63.3M
    return Result.getModRefBehavior(CS);
836
63.3M
  }
llvm::AAResults::Model<llvm::AMDGPUAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
834
1.24k
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
835
1.24k
    return Result.getModRefBehavior(CS);
836
1.24k
  }
llvm::AAResults::Model<llvm::BasicAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
834
16.1M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
835
16.1M
    return Result.getModRefBehavior(CS);
836
16.1M
  }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
834
15.9M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
835
15.9M
    return Result.getModRefBehavior(CS);
836
15.9M
  }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
834
15.9M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
835
15.9M
    return Result.getModRefBehavior(CS);
836
15.9M
  }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
834
2.65k
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
835
2.65k
    return Result.getModRefBehavior(CS);
836
2.65k
  }
llvm::AAResults::Model<llvm::GlobalsAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
834
15.4M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
835
15.4M
    return Result.getModRefBehavior(CS);
836
15.4M
  }
Unexecuted instantiation: llvm::AAResults::Model<llvm::SCEVAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
llvm::AAResults::Model<llvm::CFLAndersAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
834
284
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
835
284
    return Result.getModRefBehavior(CS);
836
284
  }
llvm::AAResults::Model<llvm::CFLSteensAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
834
359
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
835
359
    return Result.getModRefBehavior(CS);
836
359
  }
837
838
62.0M
  FunctionModRefBehavior getModRefBehavior(const Function *F) override {
839
62.0M
    return Result.getModRefBehavior(F);
840
62.0M
  }
llvm::AAResults::Model<llvm::AMDGPUAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
838
963
  FunctionModRefBehavior getModRefBehavior(const Function *F) override {
839
963
    return Result.getModRefBehavior(F);
840
963
  }
llvm::AAResults::Model<llvm::BasicAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
838
15.6M
  FunctionModRefBehavior getModRefBehavior(const Function *F) override {
839
15.6M
    return Result.getModRefBehavior(F);
840
15.6M
  }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
838
15.6M
  FunctionModRefBehavior getModRefBehavior(const Function *F) override {
839
15.6M
    return Result.getModRefBehavior(F);
840
15.6M
  }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
838
15.6M
  FunctionModRefBehavior getModRefBehavior(const Function *F) override {
839
15.6M
    return Result.getModRefBehavior(F);
840
15.6M
  }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
838
2.24k
  FunctionModRefBehavior getModRefBehavior(const Function *F) override {
839
2.24k
    return Result.getModRefBehavior(F);
840
2.24k
  }
llvm::AAResults::Model<llvm::GlobalsAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
838
15.1M
  FunctionModRefBehavior getModRefBehavior(const Function *F) override {
839
15.1M
    return Result.getModRefBehavior(F);
840
15.1M
  }
Unexecuted instantiation: llvm::AAResults::Model<llvm::SCEVAAResult>::getModRefBehavior(llvm::Function const*)
Unexecuted instantiation: llvm::AAResults::Model<llvm::CFLAndersAAResult>::getModRefBehavior(llvm::Function const*)
Unexecuted instantiation: llvm::AAResults::Model<llvm::CFLSteensAAResult>::getModRefBehavior(llvm::Function const*)
841
842
  ModRefInfo getModRefInfo(ImmutableCallSite CS,
843
29.2M
                           const MemoryLocation &Loc) override {
844
29.2M
    return Result.getModRefInfo(CS, Loc);
845
29.2M
  }
llvm::AAResults::Model<llvm::AMDGPUAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
843
11.7k
                           const MemoryLocation &Loc) override {
844
11.7k
    return Result.getModRefInfo(CS, Loc);
845
11.7k
  }
llvm::AAResults::Model<llvm::BasicAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
843
7.99M
                           const MemoryLocation &Loc) override {
844
7.99M
    return Result.getModRefInfo(CS, Loc);
845
7.99M
  }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
843
7.25M
                           const MemoryLocation &Loc) override {
844
7.25M
    return Result.getModRefInfo(CS, Loc);
845
7.25M
  }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
843
7.25M
                           const MemoryLocation &Loc) override {
844
7.25M
    return Result.getModRefInfo(CS, Loc);
845
7.25M
  }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
843
293
                           const MemoryLocation &Loc) override {
844
293
    return Result.getModRefInfo(CS, Loc);
845
293
  }
llvm::AAResults::Model<llvm::GlobalsAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
843
6.75M
                           const MemoryLocation &Loc) override {
844
6.75M
    return Result.getModRefInfo(CS, Loc);
845
6.75M
  }
Unexecuted instantiation: llvm::AAResults::Model<llvm::SCEVAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
llvm::AAResults::Model<llvm::CFLAndersAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
843
252
                           const MemoryLocation &Loc) override {
844
252
    return Result.getModRefInfo(CS, Loc);
845
252
  }
llvm::AAResults::Model<llvm::CFLSteensAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
843
299
                           const MemoryLocation &Loc) override {
844
299
    return Result.getModRefInfo(CS, Loc);
845
299
  }
846
847
  ModRefInfo getModRefInfo(ImmutableCallSite CS1,
848
6.09M
                           ImmutableCallSite CS2) override {
849
6.09M
    return Result.getModRefInfo(CS1, CS2);
850
6.09M
  }
llvm::AAResults::Model<llvm::AMDGPUAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
848
140
                           ImmutableCallSite CS2) override {
849
140
    return Result.getModRefInfo(CS1, CS2);
850
140
  }
llvm::AAResults::Model<llvm::BasicAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
848
1.52M
                           ImmutableCallSite CS2) override {
849
1.52M
    return Result.getModRefInfo(CS1, CS2);
850
1.52M
  }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
848
1.52M
                           ImmutableCallSite CS2) override {
849
1.52M
    return Result.getModRefInfo(CS1, CS2);
850
1.52M
  }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
848
1.52M
                           ImmutableCallSite CS2) override {
849
1.52M
    return Result.getModRefInfo(CS1, CS2);
850
1.52M
  }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
848
58
                           ImmutableCallSite CS2) override {
849
58
    return Result.getModRefInfo(CS1, CS2);
850
58
  }
llvm::AAResults::Model<llvm::GlobalsAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
848
1.52M
                           ImmutableCallSite CS2) override {
849
1.52M
    return Result.getModRefInfo(CS1, CS2);
850
1.52M
  }
Unexecuted instantiation: llvm::AAResults::Model<llvm::SCEVAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
llvm::AAResults::Model<llvm::CFLAndersAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
848
16
                           ImmutableCallSite CS2) override {
849
16
    return Result.getModRefInfo(CS1, CS2);
850
16
  }
llvm::AAResults::Model<llvm::CFLSteensAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
848
30
                           ImmutableCallSite CS2) override {
849
30
    return Result.getModRefInfo(CS1, CS2);
850
30
  }
851
};
852
853
/// A CRTP-driven "mixin" base class to help implement the function alias
854
/// analysis results concept.
855
///
856
/// Because of the nature of many alias analysis implementations, they often
857
/// only implement a subset of the interface. This base class will attempt to
858
/// implement the remaining portions of the interface in terms of simpler forms
859
/// of the interface where possible, and otherwise provide conservatively
860
/// correct fallback implementations.
861
///
862
/// Implementors of an alias analysis should derive from this CRTP, and then
863
/// override specific methods that they wish to customize. There is no need to
864
/// use virtual anywhere, the CRTP base class does static dispatch to the
865
/// derived type passed into it.
866
template <typename DerivedT> class AAResultBase {
867
  // Expose some parts of the interface only to the AAResults::Model
868
  // for wrapping. Specifically, this allows the model to call our
869
  // setAAResults method without exposing it as a fully public API.
870
  friend class AAResults::Model<DerivedT>;
871
872
  /// A pointer to the AAResults object that this AAResult is
873
  /// aggregated within. May be null if not aggregated.
874
  AAResults *AAR;
875
876
  /// Helper to dispatch calls back through the derived type.
877
48.2M
  DerivedT &derived() { return static_cast<DerivedT &>(*this); }
878
879
  /// A setter for the AAResults pointer, which is used to satisfy the
880
  /// AAResults::Model contract.
881
39.3M
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::AMDGPUAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
881
125k
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::BasicAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
881
10.2M
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
881
10.1M
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::TypeBasedAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
881
10.1M
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::objcarc::ObjCARCAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
881
753
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::GlobalsAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
881
8.61M
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::SCEVAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
881
25
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::CFLAndersAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
881
165
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::CFLSteensAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
881
190
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
882
883
protected:
884
  /// This proxy class models a common pattern where we delegate to either the
885
  /// top-level \c AAResults aggregation if one is registered, or to the
886
  /// current result if none are registered.
887
  class AAResultsProxy {
888
    AAResults *AAR;
889
    DerivedT &CurrentResult;
890
891
  public:
892
    AAResultsProxy(AAResults *AAR, DerivedT &CurrentResult)
893
48.2M
        : AAR(AAR), CurrentResult(CurrentResult) {}
894
895
33.2M
    AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
896
33.2M
      return AAR ? AAR->alias(LocA, LocB) : 
CurrentResult.alias(LocA, LocB)0
;
897
33.2M
    }
898
899
    bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
900
      return AAR ? AAR->pointsToConstantMemory(Loc, OrLocal)
901
                 : CurrentResult.pointsToConstantMemory(Loc, OrLocal);
902
    }
903
904
    ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
905
      return AAR ? AAR->getArgModRefInfo(CS, ArgIdx) : CurrentResult.getArgModRefInfo(CS, ArgIdx);
906
    }
907
908
    FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
909
      return AAR ? AAR->getModRefBehavior(CS) : CurrentResult.getModRefBehavior(CS);
910
    }
911
912
15.0M
    FunctionModRefBehavior getModRefBehavior(const Function *F) {
913
15.0M
      return AAR ? AAR->getModRefBehavior(F) : 
CurrentResult.getModRefBehavior(F)0
;
914
15.0M
    }
915
916
    ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
917
      return AAR ? AAR->getModRefInfo(CS, Loc)
918
                 : CurrentResult.getModRefInfo(CS, Loc);
919
    }
920
921
    ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
922
      return AAR ? AAR->getModRefInfo(CS1, CS2) : CurrentResult.getModRefInfo(CS1, CS2);
923
    }
924
  };
925
926
  explicit AAResultBase() = default;
927
928
  // Provide all the copy and move constructors so that derived types aren't
929
  // constrained.
930
  AAResultBase(const AAResultBase &Arg) {}
931
1.05M
  AAResultBase(AAResultBase &&Arg) {}
llvm::AAResultBase<llvm::CFLAndersAAResult>::AAResultBase(llvm::AAResultBase<llvm::CFLAndersAAResult>&&)
Line
Count
Source
931
82
  AAResultBase(AAResultBase &&Arg) {}
llvm::AAResultBase<llvm::CFLSteensAAResult>::AAResultBase(llvm::AAResultBase<llvm::CFLSteensAAResult>&&)
Line
Count
Source
931
84
  AAResultBase(AAResultBase &&Arg) {}
llvm::AAResultBase<llvm::GlobalsAAResult>::AAResultBase(llvm::AAResultBase<llvm::GlobalsAAResult>&&)
Line
Count
Source
931
190
  AAResultBase(AAResultBase &&Arg) {}
llvm::AAResultBase<llvm::BasicAAResult>::AAResultBase(llvm::AAResultBase<llvm::BasicAAResult>&&)
Line
Count
Source
931
1.05M
  AAResultBase(AAResultBase &&Arg) {}
llvm::AAResultBase<llvm::SCEVAAResult>::AAResultBase(llvm::AAResultBase<llvm::SCEVAAResult>&&)
Line
Count
Source
931
12
  AAResultBase(AAResultBase &&Arg) {}
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::AAResultBase(llvm::AAResultBase<llvm::ScopedNoAliasAAResult>&&)
Line
Count
Source
931
330
  AAResultBase(AAResultBase &&Arg) {}
llvm::AAResultBase<llvm::TypeBasedAAResult>::AAResultBase(llvm::AAResultBase<llvm::TypeBasedAAResult>&&)
Line
Count
Source
931
368
  AAResultBase(AAResultBase &&Arg) {}
932
933
  /// Get a proxy for the best AA result set to query at this time.
934
  ///
935
  /// When this result is part of a larger aggregation, this will proxy to that
936
  /// aggregation. When this result is used in isolation, it will just delegate
937
  /// back to the derived class's implementation.
938
  ///
939
  /// Note that callers of this need to take considerable care to not cause
940
  /// performance problems when they use this routine, in the case of a large
941
  /// number of alias analyses being aggregated, it can be expensive to walk
942
  /// back across the chain.
943
48.2M
  AAResultsProxy getBestAAResults() { return AAResultsProxy(AAR, derived()); }
944
945
public:
946
97.4M
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
947
97.4M
    return MayAlias;
948
97.4M
  }
llvm::AAResultBase<llvm::AMDGPUAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
946
66.1k
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
947
66.1k
    return MayAlias;
948
66.1k
  }
llvm::AAResultBase<llvm::CFLSteensAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
946
2.43k
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
947
2.43k
    return MayAlias;
948
2.43k
  }
llvm::AAResultBase<llvm::CFLAndersAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
946
273
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
947
273
    return MayAlias;
948
273
  }
llvm::AAResultBase<llvm::GlobalsAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
946
29.0M
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
947
29.0M
    return MayAlias;
948
29.0M
  }
llvm::AAResultBase<llvm::objcarc::ObjCARCAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
946
1.35k
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
947
1.35k
    return MayAlias;
948
1.35k
  }
llvm::AAResultBase<llvm::SCEVAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
946
64
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
947
64
    return MayAlias;
948
64
  }
llvm::AAResultBase<llvm::TypeBasedAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
946
30.0M
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
947
30.0M
    return MayAlias;
948
30.0M
  }
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
946
38.2M
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
947
38.2M
    return MayAlias;
948
38.2M
  }
949
950
65.9M
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
951
65.9M
    return false;
952
65.9M
  }
llvm::AAResultBase<llvm::AMDGPUAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
950
57.7k
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
951
57.7k
    return false;
952
57.7k
  }
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
950
18.4M
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
951
18.4M
    return false;
952
18.4M
  }
llvm::AAResultBase<llvm::GlobalsAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
950
10.5M
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
951
10.5M
    return false;
952
10.5M
  }
Unexecuted instantiation: llvm::AAResultBase<llvm::SCEVAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
llvm::AAResultBase<llvm::CFLAndersAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
950
252
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
951
252
    return false;
952
252
  }
llvm::AAResultBase<llvm::CFLSteensAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
950
298
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
951
298
    return false;
952
298
  }
llvm::AAResultBase<llvm::BasicAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
950
18.4M
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
951
18.4M
    return false;
952
18.4M
  }
llvm::AAResultBase<llvm::objcarc::ObjCARCAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
950
1.62k
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
951
1.62k
    return false;
952
1.62k
  }
llvm::AAResultBase<llvm::TypeBasedAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
950
18.4M
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
951
18.4M
    return false;
952
18.4M
  }
953
954
3.18M
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
955
3.18M
    return ModRefInfo::ModRef;
956
3.18M
  }
llvm::AAResultBase<llvm::AMDGPUAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
954
20
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
955
20
    return ModRefInfo::ModRef;
956
20
  }
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
954
883k
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
955
883k
    return ModRefInfo::ModRef;
956
883k
  }
llvm::AAResultBase<llvm::TypeBasedAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
954
883k
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
955
883k
    return ModRefInfo::ModRef;
956
883k
  }
llvm::AAResultBase<llvm::objcarc::ObjCARCAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
954
4
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
955
4
    return ModRefInfo::ModRef;
956
4
  }
llvm::AAResultBase<llvm::GlobalsAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
954
876k
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
955
876k
    return ModRefInfo::ModRef;
956
876k
  }
Unexecuted instantiation: llvm::AAResultBase<llvm::SCEVAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Unexecuted instantiation: llvm::AAResultBase<llvm::CFLAndersAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Unexecuted instantiation: llvm::AAResultBase<llvm::CFLSteensAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
llvm::AAResultBase<llvm::BasicAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
954
540k
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
955
540k
    return ModRefInfo::ModRef;
956
540k
  }
957
958
47.2M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
959
47.2M
    return FMRB_UnknownModRefBehavior;
960
47.2M
  }
llvm::AAResultBase<llvm::AMDGPUAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
958
1.24k
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
959
1.24k
    return FMRB_UnknownModRefBehavior;
960
1.24k
  }
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
958
15.9M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
959
15.9M
    return FMRB_UnknownModRefBehavior;
960
15.9M
  }
llvm::AAResultBase<llvm::objcarc::ObjCARCAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
958
2.65k
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
959
2.65k
    return FMRB_UnknownModRefBehavior;
960
2.65k
  }
Unexecuted instantiation: llvm::AAResultBase<llvm::SCEVAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
llvm::AAResultBase<llvm::CFLAndersAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
958
284
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
959
284
    return FMRB_UnknownModRefBehavior;
960
284
  }
llvm::AAResultBase<llvm::CFLSteensAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
958
359
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
959
359
    return FMRB_UnknownModRefBehavior;
960
359
  }
llvm::AAResultBase<llvm::GlobalsAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
958
15.4M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
959
15.4M
    return FMRB_UnknownModRefBehavior;
960
15.4M
  }
llvm::AAResultBase<llvm::TypeBasedAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
958
15.9M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
959
15.9M
    return FMRB_UnknownModRefBehavior;
960
15.9M
  }
961
962
46.3M
  FunctionModRefBehavior getModRefBehavior(const Function *F) {
963
46.3M
    return FMRB_UnknownModRefBehavior;
964
46.3M
  }
llvm::AAResultBase<llvm::AMDGPUAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
962
963
  FunctionModRefBehavior getModRefBehavior(const Function *F) {
963
963
    return FMRB_UnknownModRefBehavior;
964
963
  }
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
962
15.6M
  FunctionModRefBehavior getModRefBehavior(const Function *F) {
963
15.6M
    return FMRB_UnknownModRefBehavior;
964
15.6M
  }
Unexecuted instantiation: llvm::AAResultBase<llvm::SCEVAAResult>::getModRefBehavior(llvm::Function const*)
Unexecuted instantiation: llvm::AAResultBase<llvm::CFLAndersAAResult>::getModRefBehavior(llvm::Function const*)
Unexecuted instantiation: llvm::AAResultBase<llvm::CFLSteensAAResult>::getModRefBehavior(llvm::Function const*)
llvm::AAResultBase<llvm::GlobalsAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
962
15.1M
  FunctionModRefBehavior getModRefBehavior(const Function *F) {
963
15.1M
    return FMRB_UnknownModRefBehavior;
964
15.1M
  }
llvm::AAResultBase<llvm::objcarc::ObjCARCAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
962
2.24k
  FunctionModRefBehavior getModRefBehavior(const Function *F) {
963
2.24k
    return FMRB_UnknownModRefBehavior;
964
2.24k
  }
llvm::AAResultBase<llvm::TypeBasedAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
962
15.6M
  FunctionModRefBehavior getModRefBehavior(const Function *F) {
963
15.6M
    return FMRB_UnknownModRefBehavior;
964
15.6M
  }
965
966
28.3M
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
967
28.3M
    return ModRefInfo::ModRef;
968
28.3M
  }
llvm::AAResultBase<llvm::AMDGPUAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
966
11.7k
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
967
11.7k
    return ModRefInfo::ModRef;
968
11.7k
  }
Unexecuted instantiation: llvm::AAResultBase<llvm::SCEVAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
llvm::AAResultBase<llvm::CFLAndersAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
966
252
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
967
252
    return ModRefInfo::ModRef;
968
252
  }
llvm::AAResultBase<llvm::CFLSteensAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
966
299
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
967
299
    return ModRefInfo::ModRef;
968
299
  }
llvm::AAResultBase<llvm::BasicAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
966
7.09M
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
967
7.09M
    return ModRefInfo::ModRef;
968
7.09M
  }
llvm::AAResultBase<llvm::GlobalsAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
966
6.74M
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
967
6.74M
    return ModRefInfo::ModRef;
968
6.74M
  }
llvm::AAResultBase<llvm::objcarc::ObjCARCAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
966
193
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
967
193
    return ModRefInfo::ModRef;
968
193
  }
llvm::AAResultBase<llvm::TypeBasedAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
966
7.22M
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
967
7.22M
    return ModRefInfo::ModRef;
968
7.22M
  }
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
966
7.25M
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
967
7.25M
    return ModRefInfo::ModRef;
968
7.25M
  }
969
970
6.09M
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
971
6.09M
    return ModRefInfo::ModRef;
972
6.09M
  }
llvm::AAResultBase<llvm::AMDGPUAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
970
140
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
971
140
    return ModRefInfo::ModRef;
972
140
  }
llvm::AAResultBase<llvm::objcarc::ObjCARCAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
970
58
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
971
58
    return ModRefInfo::ModRef;
972
58
  }
llvm::AAResultBase<llvm::GlobalsAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
970
1.52M
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
971
1.52M
    return ModRefInfo::ModRef;
972
1.52M
  }
Unexecuted instantiation: llvm::AAResultBase<llvm::SCEVAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
llvm::AAResultBase<llvm::CFLAndersAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
970
16
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
971
16
    return ModRefInfo::ModRef;
972
16
  }
llvm::AAResultBase<llvm::CFLSteensAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
970
30
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
971
30
    return ModRefInfo::ModRef;
972
30
  }
llvm::AAResultBase<llvm::BasicAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
970
1.52M
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
971
1.52M
    return ModRefInfo::ModRef;
972
1.52M
  }
llvm::AAResultBase<llvm::TypeBasedAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
970
1.52M
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
971
1.52M
    return ModRefInfo::ModRef;
972
1.52M
  }
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
970
1.52M
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
971
1.52M
    return ModRefInfo::ModRef;
972
1.52M
  }
973
};
974
975
/// Return true if this pointer is returned by a noalias function.
976
bool isNoAliasCall(const Value *V);
977
978
/// Return true if this is an argument with the noalias attribute.
979
bool isNoAliasArgument(const Value *V);
980
981
/// Return true if this pointer refers to a distinct and identifiable object.
982
/// This returns true for:
983
///    Global Variables and Functions (but not Global Aliases)
984
///    Allocas
985
///    ByVal and NoAlias Arguments
986
///    NoAlias returns (e.g. calls to malloc)
987
///
988
bool isIdentifiedObject(const Value *V);
989
990
/// Return true if V is umabigously identified at the function-level.
991
/// Different IdentifiedFunctionLocals can't alias.
992
/// Further, an IdentifiedFunctionLocal can not alias with any function
993
/// arguments other than itself, which is not necessarily true for
994
/// IdentifiedObjects.
995
bool isIdentifiedFunctionLocal(const Value *V);
996
997
/// A manager for alias analyses.
998
///
999
/// This class can have analyses registered with it and when run, it will run
1000
/// all of them and aggregate their results into single AA results interface
1001
/// that dispatches across all of the alias analysis results available.
1002
///
1003
/// Note that the order in which analyses are registered is very significant.
1004
/// That is the order in which the results will be aggregated and queried.
1005
///
1006
/// This manager effectively wraps the AnalysisManager for registering alias
1007
/// analyses. When you register your alias analysis with this manager, it will
1008
/// ensure the analysis itself is registered with its AnalysisManager.
1009
class AAManager : public AnalysisInfoMixin<AAManager> {
1010
public:
1011
  using Result = AAResults;
1012
1013
  /// Register a specific AA result.
1014
304
  template <typename AnalysisT> void registerFunctionAnalysis() {
1015
304
    ResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>);
1016
304
  }
void llvm::AAManager::registerFunctionAnalysis<llvm::BasicAA>()
Line
Count
Source
1014
151
  template <typename AnalysisT> void registerFunctionAnalysis() {
1015
151
    ResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>);
1016
151
  }
void llvm::AAManager::registerFunctionAnalysis<llvm::ScopedNoAliasAA>()
Line
Count
Source
1014
56
  template <typename AnalysisT> void registerFunctionAnalysis() {
1015
56
    ResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>);
1016
56
  }
void llvm::AAManager::registerFunctionAnalysis<llvm::TypeBasedAA>()
Line
Count
Source
1014
60
  template <typename AnalysisT> void registerFunctionAnalysis() {
1015
60
    ResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>);
1016
60
  }
void llvm::AAManager::registerFunctionAnalysis<llvm::CFLAndersAA>()
Line
Count
Source
1014
19
  template <typename AnalysisT> void registerFunctionAnalysis() {
1015
19
    ResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>);
1016
19
  }
void llvm::AAManager::registerFunctionAnalysis<llvm::CFLSteensAA>()
Line
Count
Source
1014
17
  template <typename AnalysisT> void registerFunctionAnalysis() {
1015
17
    ResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>);
1016
17
  }
void llvm::AAManager::registerFunctionAnalysis<llvm::SCEVAA>()
Line
Count
Source
1014
1
  template <typename AnalysisT> void registerFunctionAnalysis() {
1015
1
    ResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>);
1016
1
  }
1017
1018
  /// Register a specific AA result.
1019
59
  template <typename AnalysisT> void registerModuleAnalysis() {
1020
59
    ResultGetters.push_back(&getModuleAAResultImpl<AnalysisT>);
1021
59
  }
1022
1023
1.67k
  Result run(Function &F, FunctionAnalysisManager &AM) {
1024
1.67k
    Result R(AM.getResult<TargetLibraryAnalysis>(F));
1025
1.67k
    for (auto &Getter : ResultGetters)
1026
1.84k
      (*Getter)(F, AM, R);
1027
1.67k
    return R;
1028
1.67k
  }
1029
1030
private:
1031
  friend AnalysisInfoMixin<AAManager>;
1032
1033
  static AnalysisKey Key;
1034
1035
  SmallVector<void (*)(Function &F, FunctionAnalysisManager &AM,
1036
                       AAResults &AAResults),
1037
              4> ResultGetters;
1038
1039
  template <typename AnalysisT>
1040
  static void getFunctionAAResultImpl(Function &F,
1041
                                      FunctionAnalysisManager &AM,
1042
1.53k
                                      AAResults &AAResults) {
1043
1.53k
    AAResults.addAAResult(AM.template getResult<AnalysisT>(F));
1044
1.53k
    AAResults.addAADependencyID(AnalysisT::ID());
1045
1.53k
  }
void llvm::AAManager::getFunctionAAResultImpl<llvm::BasicAA>(llvm::Function&, llvm::AnalysisManager<llvm::Function>&, llvm::AAResults&)
Line
Count
Source
1042
826
                                      AAResults &AAResults) {
1043
826
    AAResults.addAAResult(AM.template getResult<AnalysisT>(F));
1044
826
    AAResults.addAADependencyID(AnalysisT::ID());
1045
826
  }
void llvm::AAManager::getFunctionAAResultImpl<llvm::ScopedNoAliasAA>(llvm::Function&, llvm::AnalysisManager<llvm::Function>&, llvm::AAResults&)
Line
Count
Source
1042
300
                                      AAResults &AAResults) {
1043
300
    AAResults.addAAResult(AM.template getResult<AnalysisT>(F));
1044
300
    AAResults.addAADependencyID(AnalysisT::ID());
1045
300
  }
void llvm::AAManager::getFunctionAAResultImpl<llvm::TypeBasedAA>(llvm::Function&, llvm::AnalysisManager<llvm::Function>&, llvm::AAResults&)
Line
Count
Source
1042
319
                                      AAResults &AAResults) {
1043
319
    AAResults.addAAResult(AM.template getResult<AnalysisT>(F));
1044
319
    AAResults.addAADependencyID(AnalysisT::ID());
1045
319
  }
void llvm::AAManager::getFunctionAAResultImpl<llvm::CFLAndersAA>(llvm::Function&, llvm::AnalysisManager<llvm::Function>&, llvm::AAResults&)
Line
Count
Source
1042
41
                                      AAResults &AAResults) {
1043
41
    AAResults.addAAResult(AM.template getResult<AnalysisT>(F));
1044
41
    AAResults.addAADependencyID(AnalysisT::ID());
1045
41
  }
void llvm::AAManager::getFunctionAAResultImpl<llvm::CFLSteensAA>(llvm::Function&, llvm::AnalysisManager<llvm::Function>&, llvm::AAResults&)
Line
Count
Source
1042
42
                                      AAResults &AAResults) {
1043
42
    AAResults.addAAResult(AM.template getResult<AnalysisT>(F));
1044
42
    AAResults.addAADependencyID(AnalysisT::ID());
1045
42
  }
void llvm::AAManager::getFunctionAAResultImpl<llvm::SCEVAA>(llvm::Function&, llvm::AnalysisManager<llvm::Function>&, llvm::AAResults&)
Line
Count
Source
1042
6
                                      AAResults &AAResults) {
1043
6
    AAResults.addAAResult(AM.template getResult<AnalysisT>(F));
1044
6
    AAResults.addAADependencyID(AnalysisT::ID());
1045
6
  }
1046
1047
  template <typename AnalysisT>
1048
  static void getModuleAAResultImpl(Function &F, FunctionAnalysisManager &AM,
1049
306
                                    AAResults &AAResults) {
1050
306
    auto &MAMProxy = AM.getResult<ModuleAnalysisManagerFunctionProxy>(F);
1051
306
    auto &MAM = MAMProxy.getManager();
1052
306
    if (auto *R = MAM.template getCachedResult<AnalysisT>(*F.getParent())) {
1053
223
      AAResults.addAAResult(*R);
1054
223
      MAMProxy
1055
223
          .template registerOuterAnalysisInvalidation<AnalysisT, AAManager>();
1056
223
    }
1057
306
  }
1058
};
1059
1060
/// A wrapper pass to provide the legacy pass manager access to a suitably
1061
/// prepared AAResults object.
1062
class AAResultsWrapperPass : public FunctionPass {
1063
  std::unique_ptr<AAResults> AAR;
1064
1065
public:
1066
  static char ID;
1067
1068
  AAResultsWrapperPass();
1069
1070
15.5M
  AAResults &getAAResults() { return *AAR; }
1071
0
  const AAResults &getAAResults() const { return *AAR; }
1072
1073
  bool runOnFunction(Function &F) override;
1074
1075
  void getAnalysisUsage(AnalysisUsage &AU) const override;
1076
};
1077
1078
FunctionPass *createAAResultsWrapperPass();
1079
1080
/// A wrapper pass around a callback which can be used to populate the
1081
/// AAResults in the AAResultsWrapperPass from an external AA.
1082
///
1083
/// The callback provided here will be used each time we prepare an AAResults
1084
/// object, and will receive a reference to the function wrapper pass, the
1085
/// function, and the AAResults object to populate. This should be used when
1086
/// setting up a custom pass pipeline to inject a hook into the AA results.
1087
ImmutablePass *createExternalAAWrapperPass(
1088
    std::function<void(Pass &, Function &, AAResults &)> Callback);
1089
1090
/// A helper for the legacy pass manager to create a \c AAResults
1091
/// object populated to the best of our ability for a particular function when
1092
/// inside of a \c ModulePass or a \c CallGraphSCCPass.
1093
///
1094
/// If a \c ModulePass or a \c CallGraphSCCPass calls \p
1095
/// createLegacyPMAAResults, it also needs to call \p addUsedAAAnalyses in \p
1096
/// getAnalysisUsage.
1097
AAResults createLegacyPMAAResults(Pass &P, Function &F, BasicAAResult &BAR);
1098
1099
/// A helper for the legacy pass manager to populate \p AU to add uses to make
1100
/// sure the analyses required by \p createLegacyPMAAResults are available.
1101
void getAAResultsAnalysisUsage(AnalysisUsage &AU);
1102
1103
} // end namespace llvm
1104
1105
#endif // LLVM_ANALYSIS_ALIASANALYSIS_H