LLVM  14.0.0git
CaptureTracking.cpp
Go to the documentation of this file.
1 //===--- CaptureTracking.cpp - Determine whether a pointer is captured ----===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains routines that help determine which pointers are captured.
10 // A pointer value is captured if the function makes a copy of any part of the
11 // pointer that outlives the call. Not being captured means, more or less, that
12 // the pointer is only dereferenced and not stored in a global. Returning part
13 // of the pointer as the function return value may or may not count as capturing
14 // the pointer, depending on the context.
15 //
16 //===----------------------------------------------------------------------===//
17 
19 #include "llvm/ADT/SmallSet.h"
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/ADT/Statistic.h"
23 #include "llvm/Analysis/CFG.h"
25 #include "llvm/IR/Constants.h"
26 #include "llvm/IR/Dominators.h"
27 #include "llvm/IR/Instructions.h"
28 #include "llvm/IR/IntrinsicInst.h"
30 
31 using namespace llvm;
32 
33 #define DEBUG_TYPE "capture-tracking"
34 
35 STATISTIC(NumCaptured, "Number of pointers maybe captured");
36 STATISTIC(NumNotCaptured, "Number of pointers not captured");
37 STATISTIC(NumCapturedBefore, "Number of pointers maybe captured before");
38 STATISTIC(NumNotCapturedBefore, "Number of pointers not captured before");
39 
40 /// The default value for MaxUsesToExplore argument. It's relatively small to
41 /// keep the cost of analysis reasonable for clients like BasicAliasAnalysis,
42 /// where the results can't be cached.
43 /// TODO: we should probably introduce a caching CaptureTracking analysis and
44 /// use it where possible. The caching version can use much higher limit or
45 /// don't have this cap at all.
46 static cl::opt<unsigned>
47 DefaultMaxUsesToExplore("capture-tracking-max-uses-to-explore", cl::Hidden,
48  cl::desc("Maximal number of uses to explore."),
49  cl::init(20));
50 
53 }
54 
56 
57 bool CaptureTracker::shouldExplore(const Use *U) { return true; }
58 
60  // An inbounds GEP can either be a valid pointer (pointing into
61  // or to the end of an allocation), or be null in the default
62  // address space. So for an inbounds GEP there is no way to let
63  // the pointer escape using clever GEP hacking because doing so
64  // would make the pointer point outside of the allocated object
65  // and thus make the GEP result a poison value. Similarly, other
66  // dereferenceable pointers cannot be manipulated without producing
67  // poison.
68  if (auto *GEP = dyn_cast<GetElementPtrInst>(O))
69  if (GEP->isInBounds())
70  return true;
71  bool CanBeNull, CanBeFreed;
72  return O->getPointerDereferenceableBytes(DL, CanBeNull, CanBeFreed);
73 }
74 
75 namespace {
76  struct SimpleCaptureTracker : public CaptureTracker {
77  explicit SimpleCaptureTracker(bool ReturnCaptures)
78  : ReturnCaptures(ReturnCaptures), Captured(false) {}
79 
80  void tooManyUses() override { Captured = true; }
81 
82  bool captured(const Use *U) override {
83  if (isa<ReturnInst>(U->getUser()) && !ReturnCaptures)
84  return false;
85 
86  Captured = true;
87  return true;
88  }
89 
90  bool ReturnCaptures;
91 
92  bool Captured;
93  };
94 
95  /// Only find pointer captures which happen before the given instruction. Uses
96  /// the dominator tree to determine whether one instruction is before another.
97  /// Only support the case where the Value is defined in the same basic block
98  /// as the given instruction and the use.
99  struct CapturesBefore : public CaptureTracker {
100 
101  CapturesBefore(bool ReturnCaptures, const Instruction *I,
102  const DominatorTree *DT, bool IncludeI, const LoopInfo *LI)
103  : BeforeHere(I), DT(DT), ReturnCaptures(ReturnCaptures),
104  IncludeI(IncludeI), Captured(false), LI(LI) {}
105 
106  void tooManyUses() override { Captured = true; }
107 
108  bool isSafeToPrune(Instruction *I) {
109  if (BeforeHere == I)
110  return !IncludeI;
111 
112  // We explore this usage only if the usage can reach "BeforeHere".
113  // If use is not reachable from entry, there is no need to explore.
114  if (!DT->isReachableFromEntry(I->getParent()))
115  return true;
116 
117  // Check whether there is a path from I to BeforeHere.
118  return !isPotentiallyReachable(I, BeforeHere, nullptr, DT, LI);
119  }
120 
121  bool captured(const Use *U) override {
122  Instruction *I = cast<Instruction>(U->getUser());
123  if (isa<ReturnInst>(I) && !ReturnCaptures)
124  return false;
125 
126  // Check isSafeToPrune() here rather than in shouldExplore() to avoid
127  // an expensive reachability query for every instruction we look at.
128  // Instead we only do one for actual capturing candidates.
129  if (isSafeToPrune(I))
130  return false;
131 
132  Captured = true;
133  return true;
134  }
135 
136  const Instruction *BeforeHere;
137  const DominatorTree *DT;
138 
139  bool ReturnCaptures;
140  bool IncludeI;
141 
142  bool Captured;
143 
144  const LoopInfo *LI;
145  };
146 
147  /// Find the 'earliest' instruction before which the pointer is known not to
148  /// be captured. Here an instruction A is considered earlier than instruction
149  /// B, if A dominates B. If 2 escapes do not dominate each other, the
150  /// terminator of the common dominator is chosen. If not all uses cannot be
151  /// analyzed, the earliest escape is set to the first instruction in the
152  /// function entry block.
153  // NOTE: Users have to make sure instructions compared against the earliest
154  // escape are not in a cycle.
155  struct EarliestCaptures : public CaptureTracker {
156 
157  EarliestCaptures(bool ReturnCaptures, Function &F, const DominatorTree &DT)
158  : DT(DT), ReturnCaptures(ReturnCaptures), Captured(false), F(F) {}
159 
160  void tooManyUses() override {
161  Captured = true;
162  EarliestCapture = &*F.getEntryBlock().begin();
163  }
164 
165  bool captured(const Use *U) override {
166  Instruction *I = cast<Instruction>(U->getUser());
167  if (isa<ReturnInst>(I) && !ReturnCaptures)
168  return false;
169 
170  if (!EarliestCapture) {
171  EarliestCapture = I;
172  } else if (EarliestCapture->getParent() == I->getParent()) {
173  if (I->comesBefore(EarliestCapture))
174  EarliestCapture = I;
175  } else {
176  BasicBlock *CurrentBB = I->getParent();
177  BasicBlock *EarliestBB = EarliestCapture->getParent();
178  if (DT.dominates(EarliestBB, CurrentBB)) {
179  // EarliestCapture already comes before the current use.
180  } else if (DT.dominates(CurrentBB, EarliestBB)) {
181  EarliestCapture = I;
182  } else {
183  // Otherwise find the nearest common dominator and use its terminator.
184  auto *NearestCommonDom =
185  DT.findNearestCommonDominator(CurrentBB, EarliestBB);
186  EarliestCapture = NearestCommonDom->getTerminator();
187  }
188  }
189  Captured = true;
190 
191  // Return false to continue analysis; we need to see all potential
192  // captures.
193  return false;
194  }
195 
196  Instruction *EarliestCapture = nullptr;
197 
198  const DominatorTree &DT;
199 
200  bool ReturnCaptures;
201 
202  bool Captured;
203 
204  Function &F;
205  };
206 }
207 
208 /// PointerMayBeCaptured - Return true if this pointer value may be captured
209 /// by the enclosing function (which is required to exist). This routine can
210 /// be expensive, so consider caching the results. The boolean ReturnCaptures
211 /// specifies whether returning the value (or part of it) from the function
212 /// counts as capturing it or not. The boolean StoreCaptures specified whether
213 /// storing the value (or part of it) into memory anywhere automatically
214 /// counts as capturing it or not.
216  bool ReturnCaptures, bool StoreCaptures,
217  unsigned MaxUsesToExplore) {
218  assert(!isa<GlobalValue>(V) &&
219  "It doesn't make sense to ask whether a global is captured.");
220 
221  // TODO: If StoreCaptures is not true, we could do Fancy analysis
222  // to determine whether this store is not actually an escape point.
223  // In that case, BasicAliasAnalysis should be updated as well to
224  // take advantage of this.
225  (void)StoreCaptures;
226 
227  SimpleCaptureTracker SCT(ReturnCaptures);
228  PointerMayBeCaptured(V, &SCT, MaxUsesToExplore);
229  if (SCT.Captured)
230  ++NumCaptured;
231  else
232  ++NumNotCaptured;
233  return SCT.Captured;
234 }
235 
236 /// PointerMayBeCapturedBefore - Return true if this pointer value may be
237 /// captured by the enclosing function (which is required to exist). If a
238 /// DominatorTree is provided, only captures which happen before the given
239 /// instruction are considered. This routine can be expensive, so consider
240 /// caching the results. The boolean ReturnCaptures specifies whether
241 /// returning the value (or part of it) from the function counts as capturing
242 /// it or not. The boolean StoreCaptures specified whether storing the value
243 /// (or part of it) into memory anywhere automatically counts as capturing it
244 /// or not.
245 bool llvm::PointerMayBeCapturedBefore(const Value *V, bool ReturnCaptures,
246  bool StoreCaptures, const Instruction *I,
247  const DominatorTree *DT, bool IncludeI,
248  unsigned MaxUsesToExplore,
249  const LoopInfo *LI) {
250  assert(!isa<GlobalValue>(V) &&
251  "It doesn't make sense to ask whether a global is captured.");
252 
253  if (!DT)
254  return PointerMayBeCaptured(V, ReturnCaptures, StoreCaptures,
255  MaxUsesToExplore);
256 
257  // TODO: See comment in PointerMayBeCaptured regarding what could be done
258  // with StoreCaptures.
259 
260  CapturesBefore CB(ReturnCaptures, I, DT, IncludeI, LI);
261  PointerMayBeCaptured(V, &CB, MaxUsesToExplore);
262  if (CB.Captured)
263  ++NumCapturedBefore;
264  else
265  ++NumNotCapturedBefore;
266  return CB.Captured;
267 }
268 
270  bool ReturnCaptures, bool StoreCaptures,
271  const DominatorTree &DT,
272  unsigned MaxUsesToExplore) {
273  assert(!isa<GlobalValue>(V) &&
274  "It doesn't make sense to ask whether a global is captured.");
275 
276  EarliestCaptures CB(ReturnCaptures, F, DT);
277  PointerMayBeCaptured(V, &CB, MaxUsesToExplore);
278  if (CB.Captured)
279  ++NumCapturedBefore;
280  else
281  ++NumNotCapturedBefore;
282  return CB.EarliestCapture;
283 }
284 
286  unsigned MaxUsesToExplore) {
287  assert(V->getType()->isPointerTy() && "Capture is for pointers only!");
288  if (MaxUsesToExplore == 0)
289  MaxUsesToExplore = DefaultMaxUsesToExplore;
290 
294 
295  auto AddUses = [&](const Value *V) {
296  unsigned Count = 0;
297  for (const Use &U : V->uses()) {
298  // If there are lots of uses, conservatively say that the value
299  // is captured to avoid taking too much compile time.
300  if (Count++ >= MaxUsesToExplore) {
301  Tracker->tooManyUses();
302  return false;
303  }
304  if (!Visited.insert(&U).second)
305  continue;
306  if (!Tracker->shouldExplore(&U))
307  continue;
308  Worklist.push_back(&U);
309  }
310  return true;
311  };
312  if (!AddUses(V))
313  return;
314 
315  while (!Worklist.empty()) {
316  const Use *U = Worklist.pop_back_val();
317  Instruction *I = cast<Instruction>(U->getUser());
318 
319  switch (I->getOpcode()) {
320  case Instruction::Call:
321  case Instruction::Invoke: {
322  auto *Call = cast<CallBase>(I);
323  // Not captured if the callee is readonly, doesn't return a copy through
324  // its return value and doesn't unwind (a readonly function can leak bits
325  // by throwing an exception or not depending on the input value).
326  if (Call->onlyReadsMemory() && Call->doesNotThrow() &&
327  Call->getType()->isVoidTy())
328  break;
329 
330  // The pointer is not captured if returned pointer is not captured.
331  // NOTE: CaptureTracking users should not assume that only functions
332  // marked with nocapture do not capture. This means that places like
333  // getUnderlyingObject in ValueTracking or DecomposeGEPExpression
334  // in BasicAA also need to know about this property.
336  true)) {
337  if (!AddUses(Call))
338  return;
339  break;
340  }
341 
342  // Volatile operations effectively capture the memory location that they
343  // load and store to.
344  if (auto *MI = dyn_cast<MemIntrinsic>(Call))
345  if (MI->isVolatile())
346  if (Tracker->captured(U))
347  return;
348 
349  // Not captured if only passed via 'nocapture' arguments. Note that
350  // calling a function pointer does not in itself cause the pointer to
351  // be captured. This is a subtle point considering that (for example)
352  // the callee might return its own address. It is analogous to saying
353  // that loading a value from a pointer does not cause the pointer to be
354  // captured, even though the loaded value might be the pointer itself
355  // (think of self-referential objects).
356  if (Call->isDataOperand(U) &&
357  !Call->doesNotCapture(Call->getDataOperandNo(U))) {
358  // The parameter is not marked 'nocapture' - captured.
359  if (Tracker->captured(U))
360  return;
361  }
362  break;
363  }
364  case Instruction::Load:
365  // Volatile loads make the address observable.
366  if (cast<LoadInst>(I)->isVolatile())
367  if (Tracker->captured(U))
368  return;
369  break;
370  case Instruction::VAArg:
371  // "va-arg" from a pointer does not cause it to be captured.
372  break;
373  case Instruction::Store:
374  // Stored the pointer - conservatively assume it may be captured.
375  // Volatile stores make the address observable.
376  if (U->getOperandNo() == 0 || cast<StoreInst>(I)->isVolatile())
377  if (Tracker->captured(U))
378  return;
379  break;
380  case Instruction::AtomicRMW: {
381  // atomicrmw conceptually includes both a load and store from
382  // the same location.
383  // As with a store, the location being accessed is not captured,
384  // but the value being stored is.
385  // Volatile stores make the address observable.
386  auto *ARMWI = cast<AtomicRMWInst>(I);
387  if (U->getOperandNo() == 1 || ARMWI->isVolatile())
388  if (Tracker->captured(U))
389  return;
390  break;
391  }
392  case Instruction::AtomicCmpXchg: {
393  // cmpxchg conceptually includes both a load and store from
394  // the same location.
395  // As with a store, the location being accessed is not captured,
396  // but the value being stored is.
397  // Volatile stores make the address observable.
398  auto *ACXI = cast<AtomicCmpXchgInst>(I);
399  if (U->getOperandNo() == 1 || U->getOperandNo() == 2 ||
400  ACXI->isVolatile())
401  if (Tracker->captured(U))
402  return;
403  break;
404  }
405  case Instruction::BitCast:
406  case Instruction::GetElementPtr:
407  case Instruction::PHI:
408  case Instruction::Select:
409  case Instruction::AddrSpaceCast:
410  // The original value is not captured via this if the new value isn't.
411  if (!AddUses(I))
412  return;
413  break;
414  case Instruction::ICmp: {
415  unsigned Idx = U->getOperandNo();
416  unsigned OtherIdx = 1 - Idx;
417  if (auto *CPN = dyn_cast<ConstantPointerNull>(I->getOperand(OtherIdx))) {
418  // Don't count comparisons of a no-alias return value against null as
419  // captures. This allows us to ignore comparisons of malloc results
420  // with null, for example.
421  if (CPN->getType()->getAddressSpace() == 0)
422  if (isNoAliasCall(U->get()->stripPointerCasts()))
423  break;
424  if (!I->getFunction()->nullPointerIsDefined()) {
425  auto *O = I->getOperand(Idx)->stripPointerCastsSameRepresentation();
426  // Comparing a dereferenceable_or_null pointer against null cannot
427  // lead to pointer escapes, because if it is not null it must be a
428  // valid (in-bounds) pointer.
429  if (Tracker->isDereferenceableOrNull(O, I->getModule()->getDataLayout()))
430  break;
431  }
432  }
433  // Comparison against value stored in global variable. Given the pointer
434  // does not escape, its value cannot be guessed and stored separately in a
435  // global variable.
436  auto *LI = dyn_cast<LoadInst>(I->getOperand(OtherIdx));
437  if (LI && isa<GlobalVariable>(LI->getPointerOperand()))
438  break;
439  // Otherwise, be conservative. There are crazy ways to capture pointers
440  // using comparisons.
441  if (Tracker->captured(U))
442  return;
443  break;
444  }
445  default:
446  // Something else - be conservative and say it is captured.
447  if (Tracker->captured(U))
448  return;
449  break;
450  }
451  }
452 
453  // All uses examined.
454 }
455 
457  const Value *V, SmallDenseMap<const Value *, bool, 8> *IsCapturedCache) {
459  if (IsCapturedCache) {
460  bool Inserted;
461  std::tie(CacheIt, Inserted) = IsCapturedCache->insert({V, false});
462  if (!Inserted)
463  // Found cached result, return it!
464  return CacheIt->second;
465  }
466 
467  // If this is an identified function-local object, check to see if it escapes.
468  if (isIdentifiedFunctionLocal(V)) {
469  // Set StoreCaptures to True so that we can assume in our callers that the
470  // pointer is not the result of a load instruction. Currently
471  // PointerMayBeCaptured doesn't have any special analysis for the
472  // StoreCaptures=false case; if it did, our callers could be refined to be
473  // more precise.
474  auto Ret = !PointerMayBeCaptured(V, false, /*StoreCaptures=*/true);
475  if (IsCapturedCache)
476  CacheIt->second = Ret;
477  return Ret;
478  }
479 
480  return false;
481 }
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:103
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::FindEarliestCapture
Instruction * FindEarliestCapture(const Value *V, Function &F, bool ReturnCaptures, bool StoreCaptures, const DominatorTree &DT, unsigned MaxUsesToExplore=0)
Definition: CaptureTracking.cpp:269
llvm::getDefaultMaxUsesToExploreForCaptureTracking
unsigned getDefaultMaxUsesToExploreForCaptureTracking()
getDefaultMaxUsesToExploreForCaptureTracking - Return default value of the maximal number of uses to ...
Definition: CaptureTracking.cpp:51
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:112
llvm::BasicBlock::getParent
const Function * getParent() const
Return the enclosing method, or null if none.
Definition: BasicBlock.h:107
IntrinsicInst.h
llvm::Type::isPointerTy
bool isPointerTy() const
True if this is an instance of PointerType.
Definition: Type.h:228
llvm::isNonEscapingLocalObject
bool isNonEscapingLocalObject(const Value *V, SmallDenseMap< const Value *, bool, 8 > *IsCapturedCache=nullptr)
Returns true if the pointer is to a function-local object that never escapes from the function.
Definition: CaptureTracking.cpp:456
llvm::Function
Definition: Function.h:61
llvm::CaptureTracker
This callback is used in conjunction with PointerMayBeCaptured.
Definition: CaptureTracking.h:83
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
Statistic.h
CaptureTracking.h
llvm::CaptureTracker::captured
virtual bool captured(const Use *U)=0
captured - Information about the pointer was captured by the user of use U.
llvm::SPII::Store
@ Store
Definition: SparcInstrInfo.h:33
llvm::SmallDenseMap
Definition: DenseMap.h:880
ValueTracking.h
llvm::DominatorTree
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: Dominators.h:151
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
llvm::DenseMapIterator
Definition: DenseMap.h:56
llvm::SmallSet
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
Definition: SmallSet.h:134
llvm::MipsISD::Ret
@ Ret
Definition: MipsISelLowering.h:116
llvm::SmallVectorImpl::pop_back_val
LLVM_NODISCARD T pop_back_val()
Definition: SmallVector.h:635
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::CaptureTracker::~CaptureTracker
virtual ~CaptureTracker()
Definition: CaptureTracking.cpp:55
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
AliasAnalysis.h
llvm::isIdentifiedFunctionLocal
bool isIdentifiedFunctionLocal(const Value *V)
Return true if V is umabigously identified at the function-level.
Definition: AliasAnalysis.cpp:985
CommandLine.h
DefaultMaxUsesToExplore
static cl::opt< unsigned > DefaultMaxUsesToExplore("capture-tracking-max-uses-to-explore", cl::Hidden, cl::desc("Maximal number of uses to explore."), cl::init(20))
The default value for MaxUsesToExplore argument.
llvm::isNoAliasCall
bool isNoAliasCall(const Value *V)
Return true if this pointer is returned by a noalias function.
Definition: AliasAnalysis.cpp:961
Constants.h
llvm::CaptureTracker::shouldExplore
virtual bool shouldExplore(const Use *U)
shouldExplore - This is the use of a value derived from the pointer.
Definition: CaptureTracking.cpp:57
llvm::Value::uses
iterator_range< use_iterator > uses()
Definition: Value.h:377
false
Definition: StackSlotColoring.cpp:142
llvm::isPotentiallyReachable
bool isPotentiallyReachable(const Instruction *From, const Instruction *To, const SmallPtrSetImpl< BasicBlock * > *ExclusionSet=nullptr, const DominatorTree *DT=nullptr, const LoopInfo *LI=nullptr)
Determine whether instruction 'To' is reachable from 'From', without passing through any blocks in Ex...
Definition: CFG.cpp:236
llvm::Instruction
Definition: Instruction.h:45
llvm::STATISTIC
STATISTIC(NumFunctions, "Total number of functions")
llvm::CaptureTracker::isDereferenceableOrNull
virtual bool isDereferenceableOrNull(Value *O, const DataLayout &DL)
isDereferenceableOrNull - Overload to allow clients with additional knowledge about pointer dereferen...
Definition: CaptureTracking.cpp:59
llvm::MCID::Call
@ Call
Definition: MCInstrDesc.h:153
llvm::cl::opt
Definition: CommandLine.h:1434
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:197
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:443
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
CFG.h
llvm::LoopInfo
Definition: LoopInfo.h:1083
llvm::PointerMayBeCaptured
bool PointerMayBeCaptured(const Value *V, bool ReturnCaptures, bool StoreCaptures, unsigned MaxUsesToExplore=0)
PointerMayBeCaptured - Return true if this pointer value may be captured by the enclosing function (w...
Definition: CaptureTracking.cpp:215
llvm::Value::getType
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:256
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::SmallSet::insert
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
Definition: SmallSet.h:180
llvm::DenseMapBase< SmallDenseMap< KeyT, ValueT, 4, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::insert
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Definition: DenseMap.h:207
llvm::SPII::Load
@ Load
Definition: SparcInstrInfo.h:32
llvm::Value::stripPointerCasts
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs and address space casts.
Definition: Value.cpp:687
llvm::MCID::Select
@ Select
Definition: MCInstrDesc.h:162
Instructions.h
SmallVector.h
Dominators.h
llvm::CaptureTracker::tooManyUses
virtual void tooManyUses()=0
tooManyUses - The depth of traversal has breached a limit.
GEP
Hexagon Common GEP
Definition: HexagonCommonGEP.cpp:172
llvm::cl::desc
Definition: CommandLine.h:414
llvm::SmallVectorImpl::reserve
void reserve(size_type N)
Definition: SmallVector.h:624
llvm::PointerMayBeCapturedBefore
bool PointerMayBeCapturedBefore(const Value *V, bool ReturnCaptures, bool StoreCaptures, const Instruction *I, const DominatorTree *DT, bool IncludeI=false, unsigned MaxUsesToExplore=0, const LoopInfo *LI=nullptr)
PointerMayBeCapturedBefore - Return true if this pointer value may be captured by the enclosing funct...
Definition: CaptureTracking.cpp:245
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::isIntrinsicReturningPointerAliasingArgumentWithoutCapturing
bool isIntrinsicReturningPointerAliasingArgumentWithoutCapturing(const CallBase *Call, bool MustPreserveNullness)
{launder,strip}.invariant.group returns pointer that aliases its argument, and it only captures point...
Definition: ValueTracking.cpp:4336
llvm::Use
A Use represents the edge between a Value definition and its users.
Definition: Use.h:44
SmallSet.h