Coverage Report

Created: 2018-12-11 00:00

/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
38.7M
LLVM_NODISCARD inline bool isNoModRef(const ModRefInfo MRI) {
141
38.7M
  return (static_cast<int>(MRI) & static_cast<int>(ModRefInfo::MustModRef)) ==
142
38.7M
         static_cast<int>(ModRefInfo::Must);
143
38.7M
}
144
21.4M
LLVM_NODISCARD inline bool isModOrRefSet(const ModRefInfo MRI) {
145
21.4M
  return static_cast<int>(MRI) & static_cast<int>(ModRefInfo::MustModRef);
146
21.4M
}
147
41.1M
LLVM_NODISCARD inline bool isModAndRefSet(const ModRefInfo MRI) {
148
41.1M
  return (static_cast<int>(MRI) & static_cast<int>(ModRefInfo::MustModRef)) ==
149
41.1M
         static_cast<int>(ModRefInfo::MustModRef);
150
41.1M
}
151
66.3M
LLVM_NODISCARD inline bool isModSet(const ModRefInfo MRI) {
152
66.3M
  return static_cast<int>(MRI) & static_cast<int>(ModRefInfo::MustMod);
153
66.3M
}
154
36.2M
LLVM_NODISCARD inline bool isRefSet(const ModRefInfo MRI) {
155
36.2M
  return static_cast<int>(MRI) & static_cast<int>(ModRefInfo::MustRef);
156
36.2M
}
157
7.14M
LLVM_NODISCARD inline bool isMustSet(const ModRefInfo MRI) {
158
7.14M
  return !(static_cast<int>(MRI) & static_cast<int>(ModRefInfo::NoModRef));
159
7.14M
}
160
161
92.4k
LLVM_NODISCARD inline ModRefInfo setMod(const ModRefInfo MRI) {
162
92.4k
  return ModRefInfo(static_cast<int>(MRI) |
163
92.4k
                    static_cast<int>(ModRefInfo::MustMod));
164
92.4k
}
165
118k
LLVM_NODISCARD inline ModRefInfo setRef(const ModRefInfo MRI) {
166
118k
  return ModRefInfo(static_cast<int>(MRI) |
167
118k
                    static_cast<int>(ModRefInfo::MustRef));
168
118k
}
169
481k
LLVM_NODISCARD inline ModRefInfo setMust(const ModRefInfo MRI) {
170
481k
  return ModRefInfo(static_cast<int>(MRI) &
171
481k
                    static_cast<int>(ModRefInfo::MustModRef));
172
481k
}
173
11.4k
LLVM_NODISCARD inline ModRefInfo setModAndRef(const ModRefInfo MRI) {
174
11.4k
  return ModRefInfo(static_cast<int>(MRI) |
175
11.4k
                    static_cast<int>(ModRefInfo::MustModRef));
176
11.4k
}
177
76.5k
LLVM_NODISCARD inline ModRefInfo clearMod(const ModRefInfo MRI) {
178
76.5k
  return ModRefInfo(static_cast<int>(MRI) & static_cast<int>(ModRefInfo::Ref));
179
76.5k
}
180
434
LLVM_NODISCARD inline ModRefInfo clearRef(const ModRefInfo MRI) {
181
434
  return ModRefInfo(static_cast<int>(MRI) & static_cast<int>(ModRefInfo::Mod));
182
434
}
183
40.5M
LLVM_NODISCARD inline ModRefInfo clearMust(const ModRefInfo MRI) {
184
40.5M
  return ModRefInfo(static_cast<int>(MRI) |
185
40.5M
                    static_cast<int>(ModRefInfo::NoModRef));
186
40.5M
}
187
LLVM_NODISCARD inline ModRefInfo unionModRef(const ModRefInfo MRI1,
188
534k
                                             const ModRefInfo MRI2) {
189
534k
  return ModRefInfo(static_cast<int>(MRI1) | static_cast<int>(MRI2));
190
534k
}
191
LLVM_NODISCARD inline ModRefInfo intersectModRef(const ModRefInfo MRI1,
192
43.3M
                                                 const ModRefInfo MRI2) {
193
43.3M
  return ModRefInfo(static_cast<int>(MRI1) & static_cast<int>(MRI2));
194
43.3M
}
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
26.2M
createModRefInfo(const FunctionModRefBehavior FMRB) {
287
26.2M
  return ModRefInfo(FMRB & static_cast<int>(ModRefInfo::ModRef));
288
26.2M
}
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
10.2M
  AAResults(const TargetLibraryInfo &TLI) : TLI(TLI) {}
295
  AAResults(AAResults &&Arg);
296
  ~AAResults();
297
298
  /// Register a specific AA result.
299
38.7M
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
38.7M
    // FIXME: We should use a much lighter weight system than the usual
301
38.7M
    // polymorphic pattern because we don't own AAResult. It should
302
38.7M
    // ideally involve two pointers and no separate allocation.
303
38.7M
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
38.7M
  }
void llvm::AAResults::addAAResult<llvm::AMDGPUAAResult>(llvm::AMDGPUAAResult&)
Line
Count
Source
299
161k
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
161k
    // FIXME: We should use a much lighter weight system than the usual
301
161k
    // polymorphic pattern because we don't own AAResult. It should
302
161k
    // ideally involve two pointers and no separate allocation.
303
161k
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
161k
  }
void llvm::AAResults::addAAResult<llvm::BasicAAResult>(llvm::BasicAAResult&)
Line
Count
Source
299
10.2M
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
10.2M
    // FIXME: We should use a much lighter weight system than the usual
301
10.2M
    // polymorphic pattern because we don't own AAResult. It should
302
10.2M
    // ideally involve two pointers and no separate allocation.
303
10.2M
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
10.2M
  }
void llvm::AAResults::addAAResult<llvm::ScopedNoAliasAAResult>(llvm::ScopedNoAliasAAResult&)
Line
Count
Source
299
10.2M
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
10.2M
    // FIXME: We should use a much lighter weight system than the usual
301
10.2M
    // polymorphic pattern because we don't own AAResult. It should
302
10.2M
    // ideally involve two pointers and no separate allocation.
303
10.2M
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
10.2M
  }
void llvm::AAResults::addAAResult<llvm::TypeBasedAAResult>(llvm::TypeBasedAAResult&)
Line
Count
Source
299
10.2M
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
10.2M
    // FIXME: We should use a much lighter weight system than the usual
301
10.2M
    // polymorphic pattern because we don't own AAResult. It should
302
10.2M
    // ideally involve two pointers and no separate allocation.
303
10.2M
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
10.2M
  }
void llvm::AAResults::addAAResult<llvm::objcarc::ObjCARCAAResult>(llvm::objcarc::ObjCARCAAResult&)
Line
Count
Source
299
969
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
969
    // FIXME: We should use a much lighter weight system than the usual
301
969
    // polymorphic pattern because we don't own AAResult. It should
302
969
    // ideally involve two pointers and no separate allocation.
303
969
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
969
  }
void llvm::AAResults::addAAResult<llvm::GlobalsAAResult>(llvm::GlobalsAAResult&)
Line
Count
Source
299
7.87M
  template <typename AAResultT> void addAAResult(AAResultT &AAResult) {
300
7.87M
    // FIXME: We should use a much lighter weight system than the usual
301
7.87M
    // polymorphic pattern because we don't own AAResult. It should
302
7.87M
    // ideally involve two pointers and no separate allocation.
303
7.87M
    AAs.emplace_back(new Model<AAResultT>(AAResult, *this));
304
7.87M
  }
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.69k
  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
392k
                    LocationSize V2Size) {
333
392k
    return alias(MemoryLocation(V1, V1Size), MemoryLocation(V2, V2Size));
334
392k
  }
335
336
  /// A convenience wrapper around the primary \c alias interface.
337
741
  AliasResult alias(const Value *V1, const Value *V2) {
338
741
    return alias(V1, LocationSize::unknown(), V2, LocationSize::unknown());
339
741
  }
340
341
  /// A trivial helper function to check to see if the specified pointers are
342
  /// no-alias.
343
8.96k
  bool isNoAlias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
344
8.96k
    return alias(LocA, LocB) == NoAlias;
345
8.96k
  }
346
347
  /// A convenience wrapper around the \c isNoAlias helper interface.
348
  bool isNoAlias(const Value *V1, LocationSize V1Size, const Value *V2,
349
0
                 LocationSize V2Size) {
350
0
    return isNoAlias(MemoryLocation(V1, V1Size), MemoryLocation(V2, V2Size));
351
0
  }
352
353
  /// A convenience wrapper around the \c isNoAlias helper interface.
354
0
  bool isNoAlias(const Value *V1, const Value *V2) {
355
0
    return isNoAlias(MemoryLocation(V1), MemoryLocation(V2));
356
0
  }
357
358
  /// A trivial helper function to check to see if the specified pointers are
359
  /// must-alias.
360
350k
  bool isMustAlias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
361
350k
    return alias(LocA, LocB) == MustAlias;
362
350k
  }
363
364
  /// A convenience wrapper around the \c isMustAlias helper interface.
365
386k
  bool isMustAlias(const Value *V1, const Value *V2) {
366
386k
    return alias(V1, 1, V2, 1) == MustAlias;
367
386k
  }
368
369
  /// Checks whether the given location points to constant memory, or if
370
  /// \p OrLocal is true whether it points to a local alloca.
371
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal = false);
372
373
  /// A convenience wrapper around the primary \c pointsToConstantMemory
374
  /// interface.
375
4.69M
  bool pointsToConstantMemory(const Value *P, bool OrLocal = false) {
376
4.69M
    return pointsToConstantMemory(MemoryLocation(P), OrLocal);
377
4.69M
  }
378
379
  /// @}
380
  //===--------------------------------------------------------------------===//
381
  /// \name Simple mod/ref information
382
  /// @{
383
384
  /// Get the ModRef info associated with a pointer argument of a callsite. The
385
  /// result's bits are set to indicate the allowed aliasing ModRef kinds. Note
386
  /// that these bits do not necessarily account for the overall behavior of
387
  /// the function, but rather only provide additional per-argument
388
  /// information. This never sets ModRefInfo::Must.
389
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx);
390
391
  /// Return the behavior of the given call site.
392
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS);
393
394
  /// Return the behavior when calling the given function.
395
  FunctionModRefBehavior getModRefBehavior(const Function *F);
396
397
  /// Checks if the specified call is known to never read or write memory.
398
  ///
399
  /// Note that if the call only reads from known-constant memory, it is also
400
  /// legal to return true. Also, calls that unwind the stack are legal for
401
  /// this predicate.
402
  ///
403
  /// Many optimizations (such as CSE and LICM) can be performed on such calls
404
  /// without worrying about aliasing properties, and many calls have this
405
  /// property (e.g. calls to 'sin' and 'cos').
406
  ///
407
  /// This property corresponds to the GCC 'const' attribute.
408
1.76M
  bool doesNotAccessMemory(ImmutableCallSite CS) {
409
1.76M
    return getModRefBehavior(CS) == FMRB_DoesNotAccessMemory;
410
1.76M
  }
411
412
  /// Checks if the specified function is known to never read or write memory.
413
  ///
414
  /// Note that if the function only reads from known-constant memory, it is
415
  /// also legal to return true. Also, function that unwind the stack are legal
416
  /// for this predicate.
417
  ///
418
  /// Many optimizations (such as CSE and LICM) can be performed on such calls
419
  /// to such functions without worrying about aliasing properties, and many
420
  /// functions have this property (e.g. 'sin' and 'cos').
421
  ///
422
  /// This property corresponds to the GCC 'const' attribute.
423
0
  bool doesNotAccessMemory(const Function *F) {
424
0
    return getModRefBehavior(F) == FMRB_DoesNotAccessMemory;
425
0
  }
426
427
  /// Checks if the specified call is known to only read from non-volatile
428
  /// memory (or not access memory at all).
429
  ///
430
  /// Calls that unwind the stack are legal for this predicate.
431
  ///
432
  /// This property allows many common optimizations to be performed in the
433
  /// absence of interfering store instructions, such as CSE of strlen calls.
434
  ///
435
  /// This property corresponds to the GCC 'pure' attribute.
436
1.51M
  bool onlyReadsMemory(ImmutableCallSite CS) {
437
1.51M
    return onlyReadsMemory(getModRefBehavior(CS));
438
1.51M
  }
439
440
  /// Checks if the specified function is known to only read from non-volatile
441
  /// memory (or not access memory at all).
442
  ///
443
  /// Functions that unwind the stack are legal for this predicate.
444
  ///
445
  /// This property allows many common optimizations to be performed in the
446
  /// absence of interfering store instructions, such as CSE of strlen calls.
447
  ///
448
  /// This property corresponds to the GCC 'pure' attribute.
449
0
  bool onlyReadsMemory(const Function *F) {
450
0
    return onlyReadsMemory(getModRefBehavior(F));
451
0
  }
452
453
  /// Checks if functions with the specified behavior are known to only read
454
  /// from non-volatile memory (or not access memory at all).
455
11.9M
  static bool onlyReadsMemory(FunctionModRefBehavior MRB) {
456
11.9M
    return !isModSet(createModRefInfo(MRB));
457
11.9M
  }
458
459
  /// Checks if functions with the specified behavior are known to only write
460
  /// memory (or not access memory at all).
461
8.95M
  static bool doesNotReadMemory(FunctionModRefBehavior MRB) {
462
8.95M
    return !isRefSet(createModRefInfo(MRB));
463
8.95M
  }
464
465
  /// Checks if functions with the specified behavior are known to read and
466
  /// write at most from objects pointed to by their pointer-typed arguments
467
  /// (with arbitrary offsets).
468
9.98M
  static bool onlyAccessesArgPointees(FunctionModRefBehavior MRB) {
469
9.98M
    return !(MRB & FMRL_Anywhere & ~FMRL_ArgumentPointees);
470
9.98M
  }
471
472
  /// Checks if functions with the specified behavior are known to potentially
473
  /// read or write from objects pointed to be their pointer-typed arguments
474
  /// (with arbitrary offsets).
475
1.11M
  static bool doesAccessArgPointees(FunctionModRefBehavior MRB) {
476
1.11M
    return isModOrRefSet(createModRefInfo(MRB)) &&
477
1.11M
           (MRB & FMRL_ArgumentPointees);
478
1.11M
  }
479
480
  /// Checks if functions with the specified behavior are known to read and
481
  /// write at most from memory that is inaccessible from LLVM IR.
482
0
  static bool onlyAccessesInaccessibleMem(FunctionModRefBehavior MRB) {
483
0
    return !(MRB & FMRL_Anywhere & ~FMRL_InaccessibleMem);
484
0
  }
485
486
  /// Checks if functions with the specified behavior are known to potentially
487
  /// read or write from memory that is inaccessible from LLVM IR.
488
0
  static bool doesAccessInaccessibleMem(FunctionModRefBehavior MRB) {
489
0
    return isModOrRefSet(createModRefInfo(MRB)) && (MRB & FMRL_InaccessibleMem);
490
0
  }
491
492
  /// Checks if functions with the specified behavior are known to read and
493
  /// write at most from memory that is inaccessible from LLVM IR or objects
494
  /// pointed to by their pointer-typed arguments (with arbitrary offsets).
495
6.65M
  static bool onlyAccessesInaccessibleOrArgMem(FunctionModRefBehavior MRB) {
496
6.65M
    return !(MRB & FMRL_Anywhere &
497
6.65M
             ~(FMRL_InaccessibleMem | FMRL_ArgumentPointees));
498
6.65M
  }
499
500
  /// getModRefInfo (for call sites) - Return information about whether
501
  /// a particular call site modifies or reads the specified memory location.
502
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc);
503
504
  /// getModRefInfo (for call sites) - A convenience wrapper.
505
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const Value *P,
506
174k
                           LocationSize Size) {
507
174k
    return getModRefInfo(CS, MemoryLocation(P, Size));
508
174k
  }
509
510
  /// getModRefInfo (for calls) - Return information about whether
511
  /// a particular call modifies or reads the specified memory location.
512
7.91M
  ModRefInfo getModRefInfo(const CallInst *C, const MemoryLocation &Loc) {
513
7.91M
    return getModRefInfo(ImmutableCallSite(C), Loc);
514
7.91M
  }
515
516
  /// getModRefInfo (for calls) - A convenience wrapper.
517
  ModRefInfo getModRefInfo(const CallInst *C, const Value *P,
518
134
                           LocationSize Size) {
519
134
    return getModRefInfo(C, MemoryLocation(P, Size));
520
134
  }
521
522
  /// getModRefInfo (for invokes) - Return information about whether
523
  /// a particular invoke modifies or reads the specified memory location.
524
274k
  ModRefInfo getModRefInfo(const InvokeInst *I, const MemoryLocation &Loc) {
525
274k
    return getModRefInfo(ImmutableCallSite(I), Loc);
526
274k
  }
527
528
  /// getModRefInfo (for invokes) - A convenience wrapper.
529
  ModRefInfo getModRefInfo(const InvokeInst *I, const Value *P,
530
0
                           LocationSize Size) {
531
0
    return getModRefInfo(I, MemoryLocation(P, Size));
532
0
  }
533
534
  /// getModRefInfo (for loads) - Return information about whether
535
  /// a particular load modifies or reads the specified memory location.
536
  ModRefInfo getModRefInfo(const LoadInst *L, const MemoryLocation &Loc);
537
538
  /// getModRefInfo (for loads) - A convenience wrapper.
539
  ModRefInfo getModRefInfo(const LoadInst *L, const Value *P,
540
0
                           LocationSize Size) {
541
0
    return getModRefInfo(L, MemoryLocation(P, Size));
542
0
  }
543
544
  /// getModRefInfo (for stores) - Return information about whether
545
  /// a particular store modifies or reads the specified memory location.
546
  ModRefInfo getModRefInfo(const StoreInst *S, const MemoryLocation &Loc);
547
548
  /// getModRefInfo (for stores) - A convenience wrapper.
549
  ModRefInfo getModRefInfo(const StoreInst *S, const Value *P,
550
2.83M
                           LocationSize Size) {
551
2.83M
    return getModRefInfo(S, MemoryLocation(P, Size));
552
2.83M
  }
553
554
  /// getModRefInfo (for fences) - Return information about whether
555
  /// a particular store modifies or reads the specified memory location.
556
  ModRefInfo getModRefInfo(const FenceInst *S, const MemoryLocation &Loc);
557
558
  /// getModRefInfo (for fences) - A convenience wrapper.
559
  ModRefInfo getModRefInfo(const FenceInst *S, const Value *P,
560
0
                           LocationSize Size) {
561
0
    return getModRefInfo(S, MemoryLocation(P, Size));
562
0
  }
563
564
  /// getModRefInfo (for cmpxchges) - Return information about whether
565
  /// a particular cmpxchg modifies or reads the specified memory location.
566
  ModRefInfo getModRefInfo(const AtomicCmpXchgInst *CX,
567
                           const MemoryLocation &Loc);
568
569
  /// getModRefInfo (for cmpxchges) - A convenience wrapper.
570
  ModRefInfo getModRefInfo(const AtomicCmpXchgInst *CX, const Value *P,
571
0
                           unsigned Size) {
572
0
    return getModRefInfo(CX, MemoryLocation(P, Size));
573
0
  }
574
575
  /// getModRefInfo (for atomicrmws) - Return information about whether
576
  /// a particular atomicrmw modifies or reads the specified memory location.
577
  ModRefInfo getModRefInfo(const AtomicRMWInst *RMW, const MemoryLocation &Loc);
578
579
  /// getModRefInfo (for atomicrmws) - A convenience wrapper.
580
  ModRefInfo getModRefInfo(const AtomicRMWInst *RMW, const Value *P,
581
0
                           unsigned Size) {
582
0
    return getModRefInfo(RMW, MemoryLocation(P, Size));
583
0
  }
584
585
  /// getModRefInfo (for va_args) - Return information about whether
586
  /// a particular va_arg modifies or reads the specified memory location.
587
  ModRefInfo getModRefInfo(const VAArgInst *I, const MemoryLocation &Loc);
588
589
  /// getModRefInfo (for va_args) - A convenience wrapper.
590
  ModRefInfo getModRefInfo(const VAArgInst *I, const Value *P,
591
0
                           LocationSize Size) {
592
0
    return getModRefInfo(I, MemoryLocation(P, Size));
593
0
  }
594
595
  /// getModRefInfo (for catchpads) - Return information about whether
596
  /// a particular catchpad modifies or reads the specified memory location.
597
  ModRefInfo getModRefInfo(const CatchPadInst *I, const MemoryLocation &Loc);
598
599
  /// getModRefInfo (for catchpads) - A convenience wrapper.
600
  ModRefInfo getModRefInfo(const CatchPadInst *I, const Value *P,
601
0
                           LocationSize Size) {
602
0
    return getModRefInfo(I, MemoryLocation(P, Size));
603
0
  }
604
605
  /// getModRefInfo (for catchrets) - Return information about whether
606
  /// a particular catchret modifies or reads the specified memory location.
607
  ModRefInfo getModRefInfo(const CatchReturnInst *I, const MemoryLocation &Loc);
608
609
  /// getModRefInfo (for catchrets) - A convenience wrapper.
610
  ModRefInfo getModRefInfo(const CatchReturnInst *I, const Value *P,
611
0
                           LocationSize Size) {
612
0
    return getModRefInfo(I, MemoryLocation(P, Size));
613
0
  }
614
615
  /// Check whether or not an instruction may read or write the optionally
616
  /// specified memory location.
617
  ///
618
  ///
619
  /// An instruction that doesn't read or write memory may be trivially LICM'd
620
  /// for example.
621
  ///
622
  /// For function calls, this delegates to the alias-analysis specific
623
  /// call-site mod-ref behavior queries. Otherwise it delegates to the specific
624
  /// helpers above.
625
  ModRefInfo getModRefInfo(const Instruction *I,
626
77.8M
                           const Optional<MemoryLocation> &OptLoc) {
627
77.8M
    if (OptLoc == None) {
628
26.3M
      if (auto CS = ImmutableCallSite(I)) {
629
3.38M
        return createModRefInfo(getModRefBehavior(CS));
630
3.38M
      }
631
74.5M
    }
632
74.5M
633
74.5M
    const MemoryLocation &Loc = OptLoc.getValueOr(MemoryLocation());
634
74.5M
635
74.5M
    switch (I->getOpcode()) {
636
74.5M
    
case Instruction::VAArg: return getModRefInfo((const VAArgInst*)I, Loc)1.11k
;
637
74.5M
    
case Instruction::Load: return getModRefInfo((const LoadInst*)I, Loc)3.08M
;
638
74.5M
    
case Instruction::Store: return getModRefInfo((const StoreInst*)I, Loc)7.34M
;
639
74.5M
    
case Instruction::Fence: return getModRefInfo((const FenceInst*)I, Loc)36.4k
;
640
74.5M
    case Instruction::AtomicCmpXchg:
641
27.8k
      return getModRefInfo((const AtomicCmpXchgInst*)I, Loc);
642
74.5M
    case Instruction::AtomicRMW:
643
113k
      return getModRefInfo((const AtomicRMWInst*)I, Loc);
644
74.5M
    
case Instruction::Call: return getModRefInfo((const CallInst*)I, Loc)7.91M
;
645
74.5M
    
case Instruction::Invoke: return getModRefInfo((const InvokeInst*)I,Loc)274k
;
646
74.5M
    case Instruction::CatchPad:
647
17
      return getModRefInfo((const CatchPadInst *)I, Loc);
648
74.5M
    case Instruction::CatchRet:
649
24
      return getModRefInfo((const CatchReturnInst *)I, Loc);
650
74.5M
    default:
651
55.6M
      return ModRefInfo::NoModRef;
652
74.5M
    }
653
74.5M
  }
654
655
  /// A convenience wrapper for constructing the memory location.
656
  ModRefInfo getModRefInfo(const Instruction *I, const Value *P,
657
3.38M
                           LocationSize Size) {
658
3.38M
    return getModRefInfo(I, MemoryLocation(P, Size));
659
3.38M
  }
660
661
  /// Return information about whether a call and an instruction may refer to
662
  /// the same memory locations.
663
  ModRefInfo getModRefInfo(Instruction *I, ImmutableCallSite Call);
664
665
  /// Return information about whether two call sites may refer to the same set
666
  /// of memory locations. See the AA documentation for details:
667
  ///   http://llvm.org/docs/AliasAnalysis.html#ModRefInfo
668
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2);
669
670
  /// Return information about whether a particular call site modifies
671
  /// or reads the specified memory location \p MemLoc before instruction \p I
672
  /// in a BasicBlock. An ordered basic block \p OBB can be used to speed up
673
  /// instruction ordering queries inside the BasicBlock containing \p I.
674
  /// Early exits in callCapturesBefore may lead to ModRefInfo::Must not being
675
  /// set.
676
  ModRefInfo callCapturesBefore(const Instruction *I,
677
                                const MemoryLocation &MemLoc, DominatorTree *DT,
678
                                OrderedBasicBlock *OBB = nullptr);
679
680
  /// A convenience wrapper to synthesize a memory location.
681
  ModRefInfo callCapturesBefore(const Instruction *I, const Value *P,
682
                                LocationSize Size, DominatorTree *DT,
683
4
                                OrderedBasicBlock *OBB = nullptr) {
684
4
    return callCapturesBefore(I, MemoryLocation(P, Size), DT, OBB);
685
4
  }
686
687
  /// @}
688
  //===--------------------------------------------------------------------===//
689
  /// \name Higher level methods for querying mod/ref information.
690
  /// @{
691
692
  /// Check if it is possible for execution of the specified basic block to
693
  /// modify the location Loc.
694
  bool canBasicBlockModify(const BasicBlock &BB, const MemoryLocation &Loc);
695
696
  /// A convenience wrapper synthesizing a memory location.
697
  bool canBasicBlockModify(const BasicBlock &BB, const Value *P,
698
0
                           LocationSize Size) {
699
0
    return canBasicBlockModify(BB, MemoryLocation(P, Size));
700
0
  }
701
702
  /// Check if it is possible for the execution of the specified instructions
703
  /// to mod\ref (according to the mode) the location Loc.
704
  ///
705
  /// The instructions to consider are all of the instructions in the range of
706
  /// [I1,I2] INCLUSIVE. I1 and I2 must be in the same basic block.
707
  bool canInstructionRangeModRef(const Instruction &I1, const Instruction &I2,
708
                                 const MemoryLocation &Loc,
709
                                 const ModRefInfo Mode);
710
711
  /// A convenience wrapper synthesizing a memory location.
712
  bool canInstructionRangeModRef(const Instruction &I1, const Instruction &I2,
713
                                 const Value *Ptr, LocationSize Size,
714
0
                                 const ModRefInfo Mode) {
715
0
    return canInstructionRangeModRef(I1, I2, MemoryLocation(Ptr, Size), Mode);
716
0
  }
717
718
private:
719
  class Concept;
720
721
  template <typename T> class Model;
722
723
  template <typename T> friend class AAResultBase;
724
725
  const TargetLibraryInfo &TLI;
726
727
  std::vector<std::unique_ptr<Concept>> AAs;
728
729
  std::vector<AnalysisKey *> AADeps;
730
};
731
732
/// Temporary typedef for legacy code that uses a generic \c AliasAnalysis
733
/// pointer or reference.
734
using AliasAnalysis = AAResults;
735
736
/// A private abstract base class describing the concept of an individual alias
737
/// analysis implementation.
738
///
739
/// This interface is implemented by any \c Model instantiation. It is also the
740
/// interface which a type used to instantiate the model must provide.
741
///
742
/// All of these methods model methods by the same name in the \c
743
/// AAResults class. Only differences and specifics to how the
744
/// implementations are called are documented here.
745
class AAResults::Concept {
746
public:
747
  virtual ~Concept() = 0;
748
749
  /// An update API used internally by the AAResults to provide
750
  /// a handle back to the top level aggregation.
751
  virtual void setAAResults(AAResults *NewAAR) = 0;
752
753
  //===--------------------------------------------------------------------===//
754
  /// \name Alias Queries
755
  /// @{
756
757
  /// The main low level interface to the alias analysis implementation.
758
  /// Returns an AliasResult indicating whether the two pointers are aliased to
759
  /// each other. This is the interface that must be implemented by specific
760
  /// alias analysis implementations.
761
  virtual AliasResult alias(const MemoryLocation &LocA,
762
                            const MemoryLocation &LocB) = 0;
763
764
  /// Checks whether the given location points to constant memory, or if
765
  /// \p OrLocal is true whether it points to a local alloca.
766
  virtual bool pointsToConstantMemory(const MemoryLocation &Loc,
767
                                      bool OrLocal) = 0;
768
769
  /// @}
770
  //===--------------------------------------------------------------------===//
771
  /// \name Simple mod/ref information
772
  /// @{
773
774
  /// Get the ModRef info associated with a pointer argument of a callsite. The
775
  /// result's bits are set to indicate the allowed aliasing ModRef kinds. Note
776
  /// that these bits do not necessarily account for the overall behavior of
777
  /// the function, but rather only provide additional per-argument
778
  /// information.
779
  virtual ModRefInfo getArgModRefInfo(ImmutableCallSite CS,
780
                                      unsigned ArgIdx) = 0;
781
782
  /// Return the behavior of the given call site.
783
  virtual FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) = 0;
784
785
  /// Return the behavior when calling the given function.
786
  virtual FunctionModRefBehavior getModRefBehavior(const Function *F) = 0;
787
788
  /// getModRefInfo (for call sites) - Return information about whether
789
  /// a particular call site modifies or reads the specified memory location.
790
  virtual ModRefInfo getModRefInfo(ImmutableCallSite CS,
791
                                   const MemoryLocation &Loc) = 0;
792
793
  /// Return information about whether two call sites may refer to the same set
794
  /// of memory locations. See the AA documentation for details:
795
  ///   http://llvm.org/docs/AliasAnalysis.html#ModRefInfo
796
  virtual ModRefInfo getModRefInfo(ImmutableCallSite CS1,
797
                                   ImmutableCallSite CS2) = 0;
798
799
  /// @}
800
};
801
802
/// A private class template which derives from \c Concept and wraps some other
803
/// type.
804
///
805
/// This models the concept by directly forwarding each interface point to the
806
/// wrapped type which must implement a compatible interface. This provides
807
/// a type erased binding.
808
template <typename AAResultT> class AAResults::Model final : public Concept {
809
  AAResultT &Result;
810
811
public:
812
38.7M
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
813
38.7M
    Result.setAAResults(&AAR);
814
38.7M
  }
llvm::AAResults::Model<llvm::AMDGPUAAResult>::Model(llvm::AMDGPUAAResult&, llvm::AAResults&)
Line
Count
Source
812
161k
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
813
161k
    Result.setAAResults(&AAR);
814
161k
  }
llvm::AAResults::Model<llvm::BasicAAResult>::Model(llvm::BasicAAResult&, llvm::AAResults&)
Line
Count
Source
812
10.2M
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
813
10.2M
    Result.setAAResults(&AAR);
814
10.2M
  }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::Model(llvm::ScopedNoAliasAAResult&, llvm::AAResults&)
Line
Count
Source
812
10.2M
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
813
10.2M
    Result.setAAResults(&AAR);
814
10.2M
  }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::Model(llvm::TypeBasedAAResult&, llvm::AAResults&)
Line
Count
Source
812
10.2M
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
813
10.2M
    Result.setAAResults(&AAR);
814
10.2M
  }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::Model(llvm::objcarc::ObjCARCAAResult&, llvm::AAResults&)
Line
Count
Source
812
969
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
813
969
    Result.setAAResults(&AAR);
814
969
  }
llvm::AAResults::Model<llvm::GlobalsAAResult>::Model(llvm::GlobalsAAResult&, llvm::AAResults&)
Line
Count
Source
812
7.87M
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
813
7.87M
    Result.setAAResults(&AAR);
814
7.87M
  }
llvm::AAResults::Model<llvm::SCEVAAResult>::Model(llvm::SCEVAAResult&, llvm::AAResults&)
Line
Count
Source
812
13
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
813
13
    Result.setAAResults(&AAR);
814
13
  }
llvm::AAResults::Model<llvm::CFLAndersAAResult>::Model(llvm::CFLAndersAAResult&, llvm::AAResults&)
Line
Count
Source
812
83
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
813
83
    Result.setAAResults(&AAR);
814
83
  }
llvm::AAResults::Model<llvm::CFLSteensAAResult>::Model(llvm::CFLSteensAAResult&, llvm::AAResults&)
Line
Count
Source
812
106
  explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
813
106
    Result.setAAResults(&AAR);
814
106
  }
815
38.7M
  ~Model() override = default;
llvm::AAResults::Model<llvm::AMDGPUAAResult>::~Model()
Line
Count
Source
815
161k
  ~Model() override = default;
llvm::AAResults::Model<llvm::BasicAAResult>::~Model()
Line
Count
Source
815
10.2M
  ~Model() override = default;
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::~Model()
Line
Count
Source
815
10.2M
  ~Model() override = default;
llvm::AAResults::Model<llvm::TypeBasedAAResult>::~Model()
Line
Count
Source
815
10.2M
  ~Model() override = default;
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::~Model()
Line
Count
Source
815
969
  ~Model() override = default;
llvm::AAResults::Model<llvm::GlobalsAAResult>::~Model()
Line
Count
Source
815
7.87M
  ~Model() override = default;
llvm::AAResults::Model<llvm::SCEVAAResult>::~Model()
Line
Count
Source
815
13
  ~Model() override = default;
llvm::AAResults::Model<llvm::CFLAndersAAResult>::~Model()
Line
Count
Source
815
83
  ~Model() override = default;
llvm::AAResults::Model<llvm::CFLSteensAAResult>::~Model()
Line
Count
Source
815
106
  ~Model() override = default;
816
817
4.42M
  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
817
1.12M
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
817
1.10M
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
817
1.10M
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
817
86
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
llvm::AAResults::Model<llvm::GlobalsAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
817
1.09M
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
llvm::AAResults::Model<llvm::SCEVAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
817
12
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
llvm::AAResults::Model<llvm::CFLAndersAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
817
82
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
llvm::AAResults::Model<llvm::CFLSteensAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
817
84
  void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
818
819
  AliasResult alias(const MemoryLocation &LocA,
820
204M
                    const MemoryLocation &LocB) override {
821
204M
    return Result.alias(LocA, LocB);
822
204M
  }
llvm::AAResults::Model<llvm::AMDGPUAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
820
75.1k
                    const MemoryLocation &LocB) override {
821
75.1k
    return Result.alias(LocA, LocB);
822
75.1k
  }
llvm::AAResults::Model<llvm::BasicAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
820
83.1M
                    const MemoryLocation &LocB) override {
821
83.1M
    return Result.alias(LocA, LocB);
822
83.1M
  }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
820
44.8M
                    const MemoryLocation &LocB) override {
821
44.8M
    return Result.alias(LocA, LocB);
822
44.8M
  }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
820
44.6M
                    const MemoryLocation &LocB) override {
821
44.6M
    return Result.alias(LocA, LocB);
822
44.6M
  }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
820
1.31k
                    const MemoryLocation &LocB) override {
821
1.31k
    return Result.alias(LocA, LocB);
822
1.31k
  }
llvm::AAResults::Model<llvm::GlobalsAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
820
31.7M
                    const MemoryLocation &LocB) override {
821
31.7M
    return Result.alias(LocA, LocB);
822
31.7M
  }
llvm::AAResults::Model<llvm::SCEVAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
820
124
                    const MemoryLocation &LocB) override {
821
124
    return Result.alias(LocA, LocB);
822
124
  }
llvm::AAResults::Model<llvm::CFLAndersAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
820
665
                    const MemoryLocation &LocB) override {
821
665
    return Result.alias(LocA, LocB);
822
665
  }
llvm::AAResults::Model<llvm::CFLSteensAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
820
2.80k
                    const MemoryLocation &LocB) override {
821
2.80k
    return Result.alias(LocA, LocB);
822
2.80k
  }
823
824
  bool pointsToConstantMemory(const MemoryLocation &Loc,
825
80.7M
                              bool OrLocal) override {
826
80.7M
    return Result.pointsToConstantMemory(Loc, OrLocal);
827
80.7M
  }
llvm::AAResults::Model<llvm::AMDGPUAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
825
90.0k
                              bool OrLocal) override {
826
90.0k
    return Result.pointsToConstantMemory(Loc, OrLocal);
827
90.0k
  }
llvm::AAResults::Model<llvm::BasicAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
825
23.2M
                              bool OrLocal) override {
826
23.2M
    return Result.pointsToConstantMemory(Loc, OrLocal);
827
23.2M
  }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
825
22.7M
                              bool OrLocal) override {
826
22.7M
    return Result.pointsToConstantMemory(Loc, OrLocal);
827
22.7M
  }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
825
22.7M
                              bool OrLocal) override {
826
22.7M
    return Result.pointsToConstantMemory(Loc, OrLocal);
827
22.7M
  }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
825
1.55k
                              bool OrLocal) override {
826
1.55k
    return Result.pointsToConstantMemory(Loc, OrLocal);
827
1.55k
  }
llvm::AAResults::Model<llvm::GlobalsAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
825
11.9M
                              bool OrLocal) override {
826
11.9M
    return Result.pointsToConstantMemory(Loc, OrLocal);
827
11.9M
  }
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
825
252
                              bool OrLocal) override {
826
252
    return Result.pointsToConstantMemory(Loc, OrLocal);
827
252
  }
llvm::AAResults::Model<llvm::CFLSteensAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
825
298
                              bool OrLocal) override {
826
298
    return Result.pointsToConstantMemory(Loc, OrLocal);
827
298
  }
828
829
2.12M
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) override {
830
2.12M
    return Result.getArgModRefInfo(CS, ArgIdx);
831
2.12M
  }
llvm::AAResults::Model<llvm::AMDGPUAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
829
19
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) override {
830
19
    return Result.getArgModRefInfo(CS, ArgIdx);
831
19
  }
llvm::AAResults::Model<llvm::BasicAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
829
544k
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) override {
830
544k
    return Result.getArgModRefInfo(CS, ArgIdx);
831
544k
  }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
829
543k
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) override {
830
543k
    return Result.getArgModRefInfo(CS, ArgIdx);
831
543k
  }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
829
543k
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) override {
830
543k
    return Result.getArgModRefInfo(CS, ArgIdx);
831
543k
  }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
829
3
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) override {
830
3
    return Result.getArgModRefInfo(CS, ArgIdx);
831
3
  }
llvm::AAResults::Model<llvm::GlobalsAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
829
494k
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) override {
830
494k
    return Result.getArgModRefInfo(CS, ArgIdx);
831
494k
  }
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)
832
833
66.7M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
834
66.7M
    return Result.getModRefBehavior(CS);
835
66.7M
  }
llvm::AAResults::Model<llvm::AMDGPUAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
833
1.28k
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
834
1.28k
    return Result.getModRefBehavior(CS);
835
1.28k
  }
llvm::AAResults::Model<llvm::BasicAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
833
17.5M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
834
17.5M
    return Result.getModRefBehavior(CS);
835
17.5M
  }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
833
17.2M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
834
17.2M
    return Result.getModRefBehavior(CS);
835
17.2M
  }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
833
17.3M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
834
17.3M
    return Result.getModRefBehavior(CS);
835
17.3M
  }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
833
3.16k
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
834
3.16k
    return Result.getModRefBehavior(CS);
835
3.16k
  }
llvm::AAResults::Model<llvm::GlobalsAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
833
14.5M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
834
14.5M
    return Result.getModRefBehavior(CS);
835
14.5M
  }
Unexecuted instantiation: llvm::AAResults::Model<llvm::SCEVAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
llvm::AAResults::Model<llvm::CFLAndersAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
833
284
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
834
284
    return Result.getModRefBehavior(CS);
835
284
  }
llvm::AAResults::Model<llvm::CFLSteensAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
833
359
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
834
359
    return Result.getModRefBehavior(CS);
835
359
  }
836
837
64.8M
  FunctionModRefBehavior getModRefBehavior(const Function *F) override {
838
64.8M
    return Result.getModRefBehavior(F);
839
64.8M
  }
llvm::AAResults::Model<llvm::AMDGPUAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
837
1.00k
  FunctionModRefBehavior getModRefBehavior(const Function *F) override {
838
1.00k
    return Result.getModRefBehavior(F);
839
1.00k
  }
llvm::AAResults::Model<llvm::BasicAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
837
16.8M
  FunctionModRefBehavior getModRefBehavior(const Function *F) override {
838
16.8M
    return Result.getModRefBehavior(F);
839
16.8M
  }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
837
16.8M
  FunctionModRefBehavior getModRefBehavior(const Function *F) override {
838
16.8M
    return Result.getModRefBehavior(F);
839
16.8M
  }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
837
16.8M
  FunctionModRefBehavior getModRefBehavior(const Function *F) override {
838
16.8M
    return Result.getModRefBehavior(F);
839
16.8M
  }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
837
2.77k
  FunctionModRefBehavior getModRefBehavior(const Function *F) override {
838
2.77k
    return Result.getModRefBehavior(F);
839
2.77k
  }
llvm::AAResults::Model<llvm::GlobalsAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
837
14.3M
  FunctionModRefBehavior getModRefBehavior(const Function *F) override {
838
14.3M
    return Result.getModRefBehavior(F);
839
14.3M
  }
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*)
840
841
  ModRefInfo getModRefInfo(ImmutableCallSite CS,
842
30.7M
                           const MemoryLocation &Loc) override {
843
30.7M
    return Result.getModRefInfo(CS, Loc);
844
30.7M
  }
llvm::AAResults::Model<llvm::AMDGPUAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
842
12.7k
                           const MemoryLocation &Loc) override {
843
12.7k
    return Result.getModRefInfo(CS, Loc);
844
12.7k
  }
llvm::AAResults::Model<llvm::BasicAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
842
8.48M
                           const MemoryLocation &Loc) override {
843
8.48M
    return Result.getModRefInfo(CS, Loc);
844
8.48M
  }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
842
7.81M
                           const MemoryLocation &Loc) override {
843
7.81M
    return Result.getModRefInfo(CS, Loc);
844
7.81M
  }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
842
7.81M
                           const MemoryLocation &Loc) override {
843
7.81M
    return Result.getModRefInfo(CS, Loc);
844
7.81M
  }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
842
415
                           const MemoryLocation &Loc) override {
843
415
    return Result.getModRefInfo(CS, Loc);
844
415
  }
llvm::AAResults::Model<llvm::GlobalsAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
842
6.58M
                           const MemoryLocation &Loc) override {
843
6.58M
    return Result.getModRefInfo(CS, Loc);
844
6.58M
  }
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
842
252
                           const MemoryLocation &Loc) override {
843
252
    return Result.getModRefInfo(CS, Loc);
844
252
  }
llvm::AAResults::Model<llvm::CFLSteensAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
842
299
                           const MemoryLocation &Loc) override {
843
299
    return Result.getModRefInfo(CS, Loc);
844
299
  }
845
846
  ModRefInfo getModRefInfo(ImmutableCallSite CS1,
847
3.26M
                           ImmutableCallSite CS2) override {
848
3.26M
    return Result.getModRefInfo(CS1, CS2);
849
3.26M
  }
llvm::AAResults::Model<llvm::AMDGPUAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
847
138
                           ImmutableCallSite CS2) override {
848
138
    return Result.getModRefInfo(CS1, CS2);
849
138
  }
llvm::AAResults::Model<llvm::BasicAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
847
818k
                           ImmutableCallSite CS2) override {
848
818k
    return Result.getModRefInfo(CS1, CS2);
849
818k
  }
llvm::AAResults::Model<llvm::ScopedNoAliasAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
847
818k
                           ImmutableCallSite CS2) override {
848
818k
    return Result.getModRefInfo(CS1, CS2);
849
818k
  }
llvm::AAResults::Model<llvm::TypeBasedAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
847
818k
                           ImmutableCallSite CS2) override {
848
818k
    return Result.getModRefInfo(CS1, CS2);
849
818k
  }
llvm::AAResults::Model<llvm::objcarc::ObjCARCAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
847
28
                           ImmutableCallSite CS2) override {
848
28
    return Result.getModRefInfo(CS1, CS2);
849
28
  }
llvm::AAResults::Model<llvm::GlobalsAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
847
809k
                           ImmutableCallSite CS2) override {
848
809k
    return Result.getModRefInfo(CS1, CS2);
849
809k
  }
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
847
16
                           ImmutableCallSite CS2) override {
848
16
    return Result.getModRefInfo(CS1, CS2);
849
16
  }
llvm::AAResults::Model<llvm::CFLSteensAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
847
30
                           ImmutableCallSite CS2) override {
848
30
    return Result.getModRefInfo(CS1, CS2);
849
30
  }
850
};
851
852
/// A CRTP-driven "mixin" base class to help implement the function alias
853
/// analysis results concept.
854
///
855
/// Because of the nature of many alias analysis implementations, they often
856
/// only implement a subset of the interface. This base class will attempt to
857
/// implement the remaining portions of the interface in terms of simpler forms
858
/// of the interface where possible, and otherwise provide conservatively
859
/// correct fallback implementations.
860
///
861
/// Implementors of an alias analysis should derive from this CRTP, and then
862
/// override specific methods that they wish to customize. There is no need to
863
/// use virtual anywhere, the CRTP base class does static dispatch to the
864
/// derived type passed into it.
865
template <typename DerivedT> class AAResultBase {
866
  // Expose some parts of the interface only to the AAResults::Model
867
  // for wrapping. Specifically, this allows the model to call our
868
  // setAAResults method without exposing it as a fully public API.
869
  friend class AAResults::Model<DerivedT>;
870
871
  /// A pointer to the AAResults object that this AAResult is
872
  /// aggregated within. May be null if not aggregated.
873
  AAResults *AAR;
874
875
  /// Helper to dispatch calls back through the derived type.
876
55.2M
  DerivedT &derived() { return static_cast<DerivedT &>(*this); }
877
878
  /// A setter for the AAResults pointer, which is used to satisfy the
879
  /// AAResults::Model contract.
880
43.1M
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::AMDGPUAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
880
161k
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::BasicAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
880
11.4M
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
880
11.3M
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::TypeBasedAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
880
11.3M
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::objcarc::ObjCARCAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
880
1.05k
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::GlobalsAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
880
8.97M
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::SCEVAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
880
25
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::CFLAndersAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
880
165
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
llvm::AAResultBase<llvm::CFLSteensAAResult>::setAAResults(llvm::AAResults*)
Line
Count
Source
880
190
  void setAAResults(AAResults *NewAAR) { AAR = NewAAR; }
881
882
protected:
883
  /// This proxy class models a common pattern where we delegate to either the
884
  /// top-level \c AAResults aggregation if one is registered, or to the
885
  /// current result if none are registered.
886
  class AAResultsProxy {
887
    AAResults *AAR;
888
    DerivedT &CurrentResult;
889
890
  public:
891
    AAResultsProxy(AAResults *AAR, DerivedT &CurrentResult)
892
55.2M
        : AAR(AAR), CurrentResult(CurrentResult) {}
893
894
38.9M
    AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
895
38.9M
      return AAR ? 
AAR->alias(LocA, LocB)38.9M
:
CurrentResult.alias(LocA, LocB)2
;
896
38.9M
    }
897
898
    bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
899
      return AAR ? AAR->pointsToConstantMemory(Loc, OrLocal)
900
                 : CurrentResult.pointsToConstantMemory(Loc, OrLocal);
901
    }
902
903
    ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
904
      return AAR ? AAR->getArgModRefInfo(CS, ArgIdx) : CurrentResult.getArgModRefInfo(CS, ArgIdx);
905
    }
906
907
    FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
908
      return AAR ? AAR->getModRefBehavior(CS) : CurrentResult.getModRefBehavior(CS);
909
    }
910
911
16.2M
    FunctionModRefBehavior getModRefBehavior(const Function *F) {
912
16.2M
      return AAR ? AAR->getModRefBehavior(F) : 
CurrentResult.getModRefBehavior(F)0
;
913
16.2M
    }
914
915
    ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
916
      return AAR ? AAR->getModRefInfo(CS, Loc)
917
                 : CurrentResult.getModRefInfo(CS, Loc);
918
    }
919
920
    ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
921
      return AAR ? AAR->getModRefInfo(CS1, CS2) : CurrentResult.getModRefInfo(CS1, CS2);
922
    }
923
  };
924
925
  explicit AAResultBase() = default;
926
927
  // Provide all the copy and move constructors so that derived types aren't
928
  // constrained.
929
  AAResultBase(const AAResultBase &Arg) {}
930
1.12M
  AAResultBase(AAResultBase &&Arg) {}
llvm::AAResultBase<llvm::CFLAndersAAResult>::AAResultBase(llvm::AAResultBase<llvm::CFLAndersAAResult>&&)
Line
Count
Source
930
82
  AAResultBase(AAResultBase &&Arg) {}
llvm::AAResultBase<llvm::CFLSteensAAResult>::AAResultBase(llvm::AAResultBase<llvm::CFLSteensAAResult>&&)
Line
Count
Source
930
84
  AAResultBase(AAResultBase &&Arg) {}
llvm::AAResultBase<llvm::GlobalsAAResult>::AAResultBase(llvm::AAResultBase<llvm::GlobalsAAResult>&&)
Line
Count
Source
930
212
  AAResultBase(AAResultBase &&Arg) {}
llvm::AAResultBase<llvm::BasicAAResult>::AAResultBase(llvm::AAResultBase<llvm::BasicAAResult>&&)
Line
Count
Source
930
1.12M
  AAResultBase(AAResultBase &&Arg) {}
llvm::AAResultBase<llvm::SCEVAAResult>::AAResultBase(llvm::AAResultBase<llvm::SCEVAAResult>&&)
Line
Count
Source
930
12
  AAResultBase(AAResultBase &&Arg) {}
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::AAResultBase(llvm::AAResultBase<llvm::ScopedNoAliasAAResult>&&)
Line
Count
Source
930
354
  AAResultBase(AAResultBase &&Arg) {}
llvm::AAResultBase<llvm::TypeBasedAAResult>::AAResultBase(llvm::AAResultBase<llvm::TypeBasedAAResult>&&)
Line
Count
Source
930
394
  AAResultBase(AAResultBase &&Arg) {}
931
932
  /// Get a proxy for the best AA result set to query at this time.
933
  ///
934
  /// When this result is part of a larger aggregation, this will proxy to that
935
  /// aggregation. When this result is used in isolation, it will just delegate
936
  /// back to the derived class's implementation.
937
  ///
938
  /// Note that callers of this need to take considerable care to not cause
939
  /// performance problems when they use this routine, in the case of a large
940
  /// number of alias analyses being aggregated, it can be expensive to walk
941
  /// back across the chain.
942
55.2M
  AAResultsProxy getBestAAResults() { return AAResultsProxy(AAR, derived()); }
943
944
public:
945
111M
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
946
111M
    return MayAlias;
947
111M
  }
llvm::AAResultBase<llvm::AMDGPUAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
945
63.8k
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
946
63.8k
    return MayAlias;
947
63.8k
  }
llvm::AAResultBase<llvm::CFLSteensAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
945
2.43k
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
946
2.43k
    return MayAlias;
947
2.43k
  }
llvm::AAResultBase<llvm::CFLAndersAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
945
273
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
946
273
    return MayAlias;
947
273
  }
llvm::AAResultBase<llvm::GlobalsAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
945
31.4M
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
946
31.4M
    return MayAlias;
947
31.4M
  }
llvm::AAResultBase<llvm::objcarc::ObjCARCAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
945
1.48k
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
946
1.48k
    return MayAlias;
947
1.48k
  }
llvm::AAResultBase<llvm::SCEVAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
945
64
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
946
64
    return MayAlias;
947
64
  }
llvm::AAResultBase<llvm::TypeBasedAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
945
34.9M
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
946
34.9M
    return MayAlias;
947
34.9M
  }
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::alias(llvm::MemoryLocation const&, llvm::MemoryLocation const&)
Line
Count
Source
945
44.6M
  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
946
44.6M
    return MayAlias;
947
44.6M
  }
948
949
80.1M
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
950
80.1M
    return false;
951
80.1M
  }
llvm::AAResultBase<llvm::AMDGPUAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
949
63.9k
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
950
63.9k
    return false;
951
63.9k
  }
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
949
22.7M
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
950
22.7M
    return false;
951
22.7M
  }
llvm::AAResultBase<llvm::GlobalsAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
949
11.9M
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
950
11.9M
    return false;
951
11.9M
  }
Unexecuted instantiation: llvm::AAResultBase<llvm::SCEVAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
llvm::AAResultBase<llvm::CFLAndersAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
949
252
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
950
252
    return false;
951
252
  }
llvm::AAResultBase<llvm::CFLSteensAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
949
298
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
950
298
    return false;
951
298
  }
llvm::AAResultBase<llvm::BasicAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
949
22.7M
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
950
22.7M
    return false;
951
22.7M
  }
llvm::AAResultBase<llvm::objcarc::ObjCARCAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
949
1.93k
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
950
1.93k
    return false;
951
1.93k
  }
llvm::AAResultBase<llvm::TypeBasedAAResult>::pointsToConstantMemory(llvm::MemoryLocation const&, bool)
Line
Count
Source
949
22.7M
  bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) {
950
22.7M
    return false;
951
22.7M
  }
952
953
1.74M
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
954
1.74M
    return ModRefInfo::ModRef;
955
1.74M
  }
llvm::AAResultBase<llvm::AMDGPUAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
953
19
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
954
19
    return ModRefInfo::ModRef;
955
19
  }
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
953
543k
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
954
543k
    return ModRefInfo::ModRef;
955
543k
  }
llvm::AAResultBase<llvm::TypeBasedAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
953
543k
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
954
543k
    return ModRefInfo::ModRef;
955
543k
  }
llvm::AAResultBase<llvm::objcarc::ObjCARCAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
953
3
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
954
3
    return ModRefInfo::ModRef;
955
3
  }
llvm::AAResultBase<llvm::GlobalsAAResult>::getArgModRefInfo(llvm::ImmutableCallSite, unsigned int)
Line
Count
Source
953
494k
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
954
494k
    return ModRefInfo::ModRef;
955
494k
  }
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
953
167k
  ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
954
167k
    return ModRefInfo::ModRef;
955
167k
  }
956
957
49.1M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
958
49.1M
    return FMRB_UnknownModRefBehavior;
959
49.1M
  }
llvm::AAResultBase<llvm::AMDGPUAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
957
1.28k
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
958
1.28k
    return FMRB_UnknownModRefBehavior;
959
1.28k
  }
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
957
17.2M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
958
17.2M
    return FMRB_UnknownModRefBehavior;
959
17.2M
  }
llvm::AAResultBase<llvm::objcarc::ObjCARCAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
957
3.16k
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
958
3.16k
    return FMRB_UnknownModRefBehavior;
959
3.16k
  }
Unexecuted instantiation: llvm::AAResultBase<llvm::SCEVAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
llvm::AAResultBase<llvm::CFLAndersAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
957
284
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
958
284
    return FMRB_UnknownModRefBehavior;
959
284
  }
llvm::AAResultBase<llvm::CFLSteensAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
957
359
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
958
359
    return FMRB_UnknownModRefBehavior;
959
359
  }
llvm::AAResultBase<llvm::GlobalsAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
957
14.5M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
958
14.5M
    return FMRB_UnknownModRefBehavior;
959
14.5M
  }
llvm::AAResultBase<llvm::TypeBasedAAResult>::getModRefBehavior(llvm::ImmutableCallSite)
Line
Count
Source
957
17.3M
  FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
958
17.3M
    return FMRB_UnknownModRefBehavior;
959
17.3M
  }
960
961
48.0M
  FunctionModRefBehavior getModRefBehavior(const Function *F) {
962
48.0M
    return FMRB_UnknownModRefBehavior;
963
48.0M
  }
llvm::AAResultBase<llvm::AMDGPUAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
961
1.00k
  FunctionModRefBehavior getModRefBehavior(const Function *F) {
962
1.00k
    return FMRB_UnknownModRefBehavior;
963
1.00k
  }
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
961
16.8M
  FunctionModRefBehavior getModRefBehavior(const Function *F) {
962
16.8M
    return FMRB_UnknownModRefBehavior;
963
16.8M
  }
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
961
14.3M
  FunctionModRefBehavior getModRefBehavior(const Function *F) {
962
14.3M
    return FMRB_UnknownModRefBehavior;
963
14.3M
  }
llvm::AAResultBase<llvm::objcarc::ObjCARCAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
961
2.77k
  FunctionModRefBehavior getModRefBehavior(const Function *F) {
962
2.77k
    return FMRB_UnknownModRefBehavior;
963
2.77k
  }
llvm::AAResultBase<llvm::TypeBasedAAResult>::getModRefBehavior(llvm::Function const*)
Line
Count
Source
961
16.8M
  FunctionModRefBehavior getModRefBehavior(const Function *F) {
962
16.8M
    return FMRB_UnknownModRefBehavior;
963
16.8M
  }
964
965
29.8M
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
966
29.8M
    return ModRefInfo::ModRef;
967
29.8M
  }
llvm::AAResultBase<llvm::AMDGPUAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
965
12.7k
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
966
12.7k
    return ModRefInfo::ModRef;
967
12.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
965
252
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
966
252
    return ModRefInfo::ModRef;
967
252
  }
llvm::AAResultBase<llvm::CFLSteensAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
965
299
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
966
299
    return ModRefInfo::ModRef;
967
299
  }
llvm::AAResultBase<llvm::BasicAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
965
7.62M
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
966
7.62M
    return ModRefInfo::ModRef;
967
7.62M
  }
llvm::AAResultBase<llvm::GlobalsAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
965
6.58M
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
966
6.58M
    return ModRefInfo::ModRef;
967
6.58M
  }
llvm::AAResultBase<llvm::objcarc::ObjCARCAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
965
299
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
966
299
    return ModRefInfo::ModRef;
967
299
  }
llvm::AAResultBase<llvm::TypeBasedAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
965
7.79M
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
966
7.79M
    return ModRefInfo::ModRef;
967
7.79M
  }
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::MemoryLocation const&)
Line
Count
Source
965
7.81M
  ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
966
7.81M
    return ModRefInfo::ModRef;
967
7.81M
  }
968
969
3.26M
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
970
3.26M
    return ModRefInfo::ModRef;
971
3.26M
  }
llvm::AAResultBase<llvm::AMDGPUAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
969
138
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
970
138
    return ModRefInfo::ModRef;
971
138
  }
llvm::AAResultBase<llvm::objcarc::ObjCARCAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
969
28
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
970
28
    return ModRefInfo::ModRef;
971
28
  }
llvm::AAResultBase<llvm::GlobalsAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
969
809k
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
970
809k
    return ModRefInfo::ModRef;
971
809k
  }
Unexecuted instantiation: llvm::AAResultBase<llvm::SCEVAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
llvm::AAResultBase<llvm::CFLAndersAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
969
16
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
970
16
    return ModRefInfo::ModRef;
971
16
  }
llvm::AAResultBase<llvm::CFLSteensAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
969
30
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
970
30
    return ModRefInfo::ModRef;
971
30
  }
llvm::AAResultBase<llvm::BasicAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
969
818k
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
970
818k
    return ModRefInfo::ModRef;
971
818k
  }
llvm::AAResultBase<llvm::TypeBasedAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
969
818k
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
970
818k
    return ModRefInfo::ModRef;
971
818k
  }
llvm::AAResultBase<llvm::ScopedNoAliasAAResult>::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite)
Line
Count
Source
969
818k
  ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
970
818k
    return ModRefInfo::ModRef;
971
818k
  }
972
};
973
974
/// Return true if this pointer is returned by a noalias function.
975
bool isNoAliasCall(const Value *V);
976
977
/// Return true if this is an argument with the noalias attribute.
978
bool isNoAliasArgument(const Value *V);
979
980
/// Return true if this pointer refers to a distinct and identifiable object.
981
/// This returns true for:
982
///    Global Variables and Functions (but not Global Aliases)
983
///    Allocas
984
///    ByVal and NoAlias Arguments
985
///    NoAlias returns (e.g. calls to malloc)
986
///
987
bool isIdentifiedObject(const Value *V);
988
989
/// Return true if V is umabigously identified at the function-level.
990
/// Different IdentifiedFunctionLocals can't alias.
991
/// Further, an IdentifiedFunctionLocal can not alias with any function
992
/// arguments other than itself, which is not necessarily true for
993
/// IdentifiedObjects.
994
bool isIdentifiedFunctionLocal(const Value *V);
995
996
/// A manager for alias analyses.
997
///
998
/// This class can have analyses registered with it and when run, it will run
999
/// all of them and aggregate their results into single AA results interface
1000
/// that dispatches across all of the alias analysis results available.
1001
///
1002
/// Note that the order in which analyses are registered is very significant.
1003
/// That is the order in which the results will be aggregated and queried.
1004
///
1005
/// This manager effectively wraps the AnalysisManager for registering alias
1006
/// analyses. When you register your alias analysis with this manager, it will
1007
/// ensure the analysis itself is registered with its AnalysisManager.
1008
class AAManager : public AnalysisInfoMixin<AAManager> {
1009
public:
1010
  using Result = AAResults;
1011
1012
  /// Register a specific AA result.
1013
364
  template <typename AnalysisT> void registerFunctionAnalysis() {
1014
364
    ResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>);
1015
364
  }
void llvm::AAManager::registerFunctionAnalysis<llvm::BasicAA>()
Line
Count
Source
1013
189
  template <typename AnalysisT> void registerFunctionAnalysis() {
1014
189
    ResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>);
1015
189
  }
void llvm::AAManager::registerFunctionAnalysis<llvm::ScopedNoAliasAA>()
Line
Count
Source
1013
67
  template <typename AnalysisT> void registerFunctionAnalysis() {
1014
67
    ResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>);
1015
67
  }
void llvm::AAManager::registerFunctionAnalysis<llvm::TypeBasedAA>()
Line
Count
Source
1013
71
  template <typename AnalysisT> void registerFunctionAnalysis() {
1014
71
    ResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>);
1015
71
  }
void llvm::AAManager::registerFunctionAnalysis<llvm::CFLAndersAA>()
Line
Count
Source
1013
19
  template <typename AnalysisT> void registerFunctionAnalysis() {
1014
19
    ResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>);
1015
19
  }
void llvm::AAManager::registerFunctionAnalysis<llvm::CFLSteensAA>()
Line
Count
Source
1013
17
  template <typename AnalysisT> void registerFunctionAnalysis() {
1014
17
    ResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>);
1015
17
  }
void llvm::AAManager::registerFunctionAnalysis<llvm::SCEVAA>()
Line
Count
Source
1013
1
  template <typename AnalysisT> void registerFunctionAnalysis() {
1014
1
    ResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>);
1015
1
  }
1016
1017
  /// Register a specific AA result.
1018
70
  template <typename AnalysisT> void registerModuleAnalysis() {
1019
70
    ResultGetters.push_back(&getModuleAAResultImpl<AnalysisT>);
1020
70
  }
1021
1022
2.09k
  Result run(Function &F, FunctionAnalysisManager &AM) {
1023
2.09k
    Result R(AM.getResult<TargetLibraryAnalysis>(F));
1024
2.09k
    for (auto &Getter : ResultGetters)
1025
2.01k
      (*Getter)(F, AM, R);
1026
2.09k
    return R;
1027
2.09k
  }
1028
1029
private:
1030
  friend AnalysisInfoMixin<AAManager>;
1031
1032
  static AnalysisKey Key;
1033
1034
  SmallVector<void (*)(Function &F, FunctionAnalysisManager &AM,
1035
                       AAResults &AAResults),
1036
              4> ResultGetters;
1037
1038
  template <typename AnalysisT>
1039
  static void getFunctionAAResultImpl(Function &F,
1040
                                      FunctionAnalysisManager &AM,
1041
1.69k
                                      AAResults &AAResults) {
1042
1.69k
    AAResults.addAAResult(AM.template getResult<AnalysisT>(F));
1043
1.69k
    AAResults.addAADependencyID(AnalysisT::ID());
1044
1.69k
  }
void llvm::AAManager::getFunctionAAResultImpl<llvm::BasicAA>(llvm::Function&, llvm::AnalysisManager<llvm::Function>&, llvm::AAResults&)
Line
Count
Source
1041
957
                                      AAResults &AAResults) {
1042
957
    AAResults.addAAResult(AM.template getResult<AnalysisT>(F));
1043
957
    AAResults.addAADependencyID(AnalysisT::ID());
1044
957
  }
void llvm::AAManager::getFunctionAAResultImpl<llvm::ScopedNoAliasAA>(llvm::Function&, llvm::AnalysisManager<llvm::Function>&, llvm::AAResults&)
Line
Count
Source
1041
314
                                      AAResults &AAResults) {
1042
314
    AAResults.addAAResult(AM.template getResult<AnalysisT>(F));
1043
314
    AAResults.addAADependencyID(AnalysisT::ID());
1044
314
  }
void llvm::AAManager::getFunctionAAResultImpl<llvm::TypeBasedAA>(llvm::Function&, llvm::AnalysisManager<llvm::Function>&, llvm::AAResults&)
Line
Count
Source
1041
334
                                      AAResults &AAResults) {
1042
334
    AAResults.addAAResult(AM.template getResult<AnalysisT>(F));
1043
334
    AAResults.addAADependencyID(AnalysisT::ID());
1044
334
  }
void llvm::AAManager::getFunctionAAResultImpl<llvm::CFLAndersAA>(llvm::Function&, llvm::AnalysisManager<llvm::Function>&, llvm::AAResults&)
Line
Count
Source
1041
41
                                      AAResults &AAResults) {
1042
41
    AAResults.addAAResult(AM.template getResult<AnalysisT>(F));
1043
41
    AAResults.addAADependencyID(AnalysisT::ID());
1044
41
  }
void llvm::AAManager::getFunctionAAResultImpl<llvm::CFLSteensAA>(llvm::Function&, llvm::AnalysisManager<llvm::Function>&, llvm::AAResults&)
Line
Count
Source
1041
42
                                      AAResults &AAResults) {
1042
42
    AAResults.addAAResult(AM.template getResult<AnalysisT>(F));
1043
42
    AAResults.addAADependencyID(AnalysisT::ID());
1044
42
  }
void llvm::AAManager::getFunctionAAResultImpl<llvm::SCEVAA>(llvm::Function&, llvm::AnalysisManager<llvm::Function>&, llvm::AAResults&)
Line
Count
Source
1041
6
                                      AAResults &AAResults) {
1042
6
    AAResults.addAAResult(AM.template getResult<AnalysisT>(F));
1043
6
    AAResults.addAADependencyID(AnalysisT::ID());
1044
6
  }
1045
1046
  template <typename AnalysisT>
1047
  static void getModuleAAResultImpl(Function &F, FunctionAnalysisManager &AM,
1048
320
                                    AAResults &AAResults) {
1049
320
    auto &MAMProxy = AM.getResult<ModuleAnalysisManagerFunctionProxy>(F);
1050
320
    auto &MAM = MAMProxy.getManager();
1051
320
    if (auto *R = MAM.template getCachedResult<AnalysisT>(*F.getParent())) {
1052
225
      AAResults.addAAResult(*R);
1053
225
      MAMProxy
1054
225
          .template registerOuterAnalysisInvalidation<AnalysisT, AAManager>();
1055
225
    }
1056
320
  }
1057
};
1058
1059
/// A wrapper pass to provide the legacy pass manager access to a suitably
1060
/// prepared AAResults object.
1061
class AAResultsWrapperPass : public FunctionPass {
1062
  std::unique_ptr<AAResults> AAR;
1063
1064
public:
1065
  static char ID;
1066
1067
  AAResultsWrapperPass();
1068
1069
16.9M
  AAResults &getAAResults() { return *AAR; }
1070
0
  const AAResults &getAAResults() const { return *AAR; }
1071
1072
  bool runOnFunction(Function &F) override;
1073
1074
  void getAnalysisUsage(AnalysisUsage &AU) const override;
1075
};
1076
1077
/// A wrapper pass for external alias analyses. This just squirrels away the
1078
/// callback used to run any analyses and register their results.
1079
struct ExternalAAWrapperPass : ImmutablePass {
1080
  using CallbackT = std::function<void(Pass &, Function &, AAResults &)>;
1081
1082
  CallbackT CB;
1083
1084
  static char ID;
1085
1086
0
  ExternalAAWrapperPass() : ImmutablePass(ID) {
1087
0
    initializeExternalAAWrapperPassPass(*PassRegistry::getPassRegistry());
1088
0
  }
1089
1090
  explicit ExternalAAWrapperPass(CallbackT CB)
1091
2.41k
      : ImmutablePass(ID), CB(std::move(CB)) {
1092
2.41k
    initializeExternalAAWrapperPassPass(*PassRegistry::getPassRegistry());
1093
2.41k
  }
1094
1095
2.39k
  void getAnalysisUsage(AnalysisUsage &AU) const override {
1096
2.39k
    AU.setPreservesAll();
1097
2.39k
  }
1098
};
1099
1100
FunctionPass *createAAResultsWrapperPass();
1101
1102
/// A wrapper pass around a callback which can be used to populate the
1103
/// AAResults in the AAResultsWrapperPass from an external AA.
1104
///
1105
/// The callback provided here will be used each time we prepare an AAResults
1106
/// object, and will receive a reference to the function wrapper pass, the
1107
/// function, and the AAResults object to populate. This should be used when
1108
/// setting up a custom pass pipeline to inject a hook into the AA results.
1109
ImmutablePass *createExternalAAWrapperPass(
1110
    std::function<void(Pass &, Function &, AAResults &)> Callback);
1111
1112
/// A helper for the legacy pass manager to create a \c AAResults
1113
/// object populated to the best of our ability for a particular function when
1114
/// inside of a \c ModulePass or a \c CallGraphSCCPass.
1115
///
1116
/// If a \c ModulePass or a \c CallGraphSCCPass calls \p
1117
/// createLegacyPMAAResults, it also needs to call \p addUsedAAAnalyses in \p
1118
/// getAnalysisUsage.
1119
AAResults createLegacyPMAAResults(Pass &P, Function &F, BasicAAResult &BAR);
1120
1121
/// A helper for the legacy pass manager to populate \p AU to add uses to make
1122
/// sure the analyses required by \p createLegacyPMAAResults are available.
1123
void getAAResultsAnalysisUsage(AnalysisUsage &AU);
1124
1125
} // end namespace llvm
1126
1127
#endif // LLVM_ANALYSIS_ALIASANALYSIS_H