aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/CaptureTracking.cpp
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2021-12-17 09:20:10 -0800
committerPhilip Reames <listmail@philipreames.com>2021-12-17 09:21:35 -0800
commit793c0da89e36408f9c2dd949134a4608ef54551a (patch)
tree9186aef4968db4e7a489dda0eca7fda336ac2aeb /llvm/lib/Analysis/CaptureTracking.cpp
parentbe41996f4f8cdaa4eb36c264183e508c1bd0455e (diff)
downloadllvm-793c0da89e36408f9c2dd949134a4608ef54551a.zip
llvm-793c0da89e36408f9c2dd949134a4608ef54551a.tar.gz
llvm-793c0da89e36408f9c2dd949134a4608ef54551a.tar.bz2
[capturetracking] Explicitly check for callee operand [NFC]
Pull out an explicit check rather than relying on the fact that the callee operand is not a data operand. The only real value is it gives us a clear place to move the comment, and makes the code slightly more understandable.
Diffstat (limited to 'llvm/lib/Analysis/CaptureTracking.cpp')
-rw-r--r--llvm/lib/Analysis/CaptureTracking.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/CaptureTracking.cpp b/llvm/lib/Analysis/CaptureTracking.cpp
index 8955658..9b45f45 100644
--- a/llvm/lib/Analysis/CaptureTracking.cpp
+++ b/llvm/lib/Analysis/CaptureTracking.cpp
@@ -346,13 +346,16 @@ void llvm::PointerMayBeCaptured(const Value *V, CaptureTracker *Tracker,
if (Tracker->captured(U))
return;
- // Not captured if only passed via 'nocapture' arguments. Note that
- // calling a function pointer does not in itself cause the pointer to
+ // Calling a function pointer does not in itself cause the pointer to
// be captured. This is a subtle point considering that (for example)
// the callee might return its own address. It is analogous to saying
// that loading a value from a pointer does not cause the pointer to be
// captured, even though the loaded value might be the pointer itself
// (think of self-referential objects).
+ if (Call->isCallee(U))
+ break;
+
+ // Not captured if only passed via 'nocapture' arguments.
if (Call->isDataOperand(U) &&
!Call->doesNotCapture(Call->getDataOperandNo(U))) {
// The parameter is not marked 'nocapture' - captured.