[llvm] 793c0da - [capturetracking] Explicitly check for callee operand [NFC]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 17 09:21:46 PST 2021
Author: Philip Reames
Date: 2021-12-17T09:21:35-08:00
New Revision: 793c0da89e36408f9c2dd949134a4608ef54551a
URL: https://github.com/llvm/llvm-project/commit/793c0da89e36408f9c2dd949134a4608ef54551a
DIFF: https://github.com/llvm/llvm-project/commit/793c0da89e36408f9c2dd949134a4608ef54551a.diff
LOG: [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.
Added:
Modified:
llvm/lib/Analysis/CaptureTracking.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/CaptureTracking.cpp b/llvm/lib/Analysis/CaptureTracking.cpp
index 8955658cb9e77..9b45f455be087 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.
More information about the llvm-commits
mailing list