@@ -41,17 +41,19 @@ namespace llvm {
4141 // / MaxUsesToExplore specifies how many uses the analysis should explore for
4242 // / one value before giving up due too "too many uses". If MaxUsesToExplore
4343 // / is zero, a default value is assumed.
44- // / This assumes the pointer is to a function-local object. The caller is
45- // / responsible for ensuring this.
44+ // / This function only considers captures of the passed value via its def-use
45+ // / chain, without considering captures of values it may be based on, or
46+ // / implicit captures such as for external globals.
4647 bool PointerMayBeCaptured (const Value *V, bool ReturnCaptures,
4748 unsigned MaxUsesToExplore = 0 );
4849
4950 // / Return which components of the pointer may be captured. Only consider
5051 // / components that are part of \p Mask. Once \p StopFn on the accumulated
5152 // / components returns true, the traversal is aborted early. By default, this
5253 // / happens when *any* of the components in \p Mask are captured.
53- // / This assumes the pointer is to a function-local object. The caller is
54- // / responsible for ensuring this.
54+ // / This function only considers captures of the passed value via its def-use
55+ // / chain, without considering captures of values it may be based on, or
56+ // / implicit captures such as for external globals.
5557 CaptureComponents PointerMayBeCaptured (
5658 const Value *V, bool ReturnCaptures, CaptureComponents Mask,
5759 function_ref<bool (CaptureComponents)> StopFn = capturesAnything,
@@ -68,8 +70,9 @@ namespace llvm {
6870 // / MaxUsesToExplore specifies how many uses the analysis should explore for
6971 // / one value before giving up due too "too many uses". If MaxUsesToExplore
7072 // / is zero, a default value is assumed.
71- // / This assumes the pointer is to a function-local object. The caller is
72- // / responsible for ensuring this.
73+ // / This function only considers captures of the passed value via its def-use
74+ // / chain, without considering captures of values it may be based on, or
75+ // / implicit captures such as for external globals.
7376 bool PointerMayBeCapturedBefore (const Value *V, bool ReturnCaptures,
7477 const Instruction *I, const DominatorTree *DT,
7578 bool IncludeI = false ,
@@ -81,6 +84,9 @@ namespace llvm {
8184 // / on the accumulated components returns true, the traversal is aborted
8285 // / early. By default, this happens when *any* of the components in \p Mask
8386 // / are captured.
87+ // / This function only considers captures of the passed value via its def-use
88+ // / chain, without considering captures of values it may be based on, or
89+ // / implicit captures such as for external globals.
8490 CaptureComponents PointerMayBeCapturedBefore (
8591 const Value *V, bool ReturnCaptures, const Instruction *I,
8692 const DominatorTree *DT, bool IncludeI, CaptureComponents Mask,
@@ -190,8 +196,9 @@ namespace llvm {
190196 // / MaxUsesToExplore specifies how many uses the analysis should explore for
191197 // / one value before giving up due too "too many uses". If MaxUsesToExplore
192198 // / is zero, a default value is assumed.
193- // / This assumes the pointer is to a function-local object. The caller is
194- // / responsible for ensuring this.
199+ // / This function only considers captures of the passed value via its def-use
200+ // / chain, without considering captures of values it may be based on, or
201+ // / implicit captures such as for external globals.
195202 void PointerMayBeCaptured (const Value *V, CaptureTracker *Tracker,
196203 unsigned MaxUsesToExplore = 0 );
197204
0 commit comments