[llvm] 425781b - [CaptureTracking] Use isIdentifiedFunctionLocal() (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu May 13 14:15:40 PDT 2021
Author: Nikita Popov
Date: 2021-05-13T23:06:42+02:00
New Revision: 425781bce01f2f1d5f553d3b2bf9ebbd6e15068c
URL: https://github.com/llvm/llvm-project/commit/425781bce01f2f1d5f553d3b2bf9ebbd6e15068c
DIFF: https://github.com/llvm/llvm-project/commit/425781bce01f2f1d5f553d3b2bf9ebbd6e15068c.diff
LOG: [CaptureTracking] Use isIdentifiedFunctionLocal() (NFC)
These conditions together exactly match isIdentifiedFunctionLocal(),
and this is also what we logically want to check for here.
Added:
Modified:
llvm/lib/Analysis/CaptureTracking.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/CaptureTracking.cpp b/llvm/lib/Analysis/CaptureTracking.cpp
index cf5e53b26b5d..7c3b4c6dc57a 100644
--- a/llvm/lib/Analysis/CaptureTracking.cpp
+++ b/llvm/lib/Analysis/CaptureTracking.cpp
@@ -423,8 +423,8 @@ bool llvm::isNonEscapingLocalObject(
return CacheIt->second;
}
- // If this is a local allocation, check to see if it escapes.
- if (isa<AllocaInst>(V) || isNoAliasCall(V)) {
+ // If this is an identified function-local object, check to see if it escapes.
+ if (isIdentifiedFunctionLocal(V)) {
// Set StoreCaptures to True so that we can assume in our callers that the
// pointer is not the result of a load instruction. Currently
// PointerMayBeCaptured doesn't have any special analysis for the
@@ -436,19 +436,5 @@ bool llvm::isNonEscapingLocalObject(
return Ret;
}
- // If this is an argument that corresponds to a byval or noalias argument,
- // then it has not escaped before entering the function. Check if it escapes
- // inside the function.
- if (const Argument *A = dyn_cast<Argument>(V))
- if (A->hasByValAttr() || A->hasNoAliasAttr()) {
- // Note even if the argument is marked nocapture, we still need to check
- // for copies made inside the function. The nocapture attribute only
- // specifies that there are no copies made that outlive the function.
- auto Ret = !PointerMayBeCaptured(V, false, /*StoreCaptures=*/true);
- if (IsCapturedCache)
- CacheIt->second = Ret;
- return Ret;
- }
-
return false;
}
More information about the llvm-commits
mailing list