diff options
author | Nikita Popov <npopov@redhat.com> | 2025-06-12 14:13:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-12 14:13:15 +0200 |
commit | bc7fafbeea08bf8cd9a18fa10d3d3bc63f0c45a3 (patch) | |
tree | 82a91f05642bfb051c09b98024e4d05f8296946b /llvm/lib/Analysis/CaptureTracking.cpp | |
parent | 2ecbfc0beb42abbbd2c3d28bfd576b38c44a5b46 (diff) | |
download | llvm-bc7fafbeea08bf8cd9a18fa10d3d3bc63f0c45a3.zip llvm-bc7fafbeea08bf8cd9a18fa10d3d3bc63f0c45a3.tar.gz llvm-bc7fafbeea08bf8cd9a18fa10d3d3bc63f0c45a3.tar.bz2 |
[AA] Take read-only provenance captures into account (#143097)
Update the AA CaptureAnalysis providers to return CaptureComponents, so
we can distinguish between full provenance and read-only provenance
captures.
Use this to restrict "other" memory effects on call from ModRef to Ref.
Ideally we would also apply the same reasoning for escape sources, but
the current API cannot actually convey the necessary information (we can
only say NoAlias or MayAlias, not MayAlias but only via Ref).
Diffstat (limited to 'llvm/lib/Analysis/CaptureTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/CaptureTracking.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/CaptureTracking.cpp b/llvm/lib/Analysis/CaptureTracking.cpp index d08ed17..076f417 100644 --- a/llvm/lib/Analysis/CaptureTracking.cpp +++ b/llvm/lib/Analysis/CaptureTracking.cpp @@ -249,11 +249,10 @@ bool llvm::PointerMayBeCapturedBefore(const Value *V, bool ReturnCaptures, capturesAnything, LI, MaxUsesToExplore)); } -Instruction *llvm::FindEarliestCapture(const Value *V, Function &F, - bool ReturnCaptures, - const DominatorTree &DT, - CaptureComponents Mask, - unsigned MaxUsesToExplore) { +std::pair<Instruction *, CaptureComponents> +llvm::FindEarliestCapture(const Value *V, Function &F, bool ReturnCaptures, + const DominatorTree &DT, CaptureComponents Mask, + unsigned MaxUsesToExplore) { assert(!isa<GlobalValue>(V) && "It doesn't make sense to ask whether a global is captured."); @@ -263,7 +262,7 @@ Instruction *llvm::FindEarliestCapture(const Value *V, Function &F, ++NumCapturedBefore; else ++NumNotCapturedBefore; - return CB.EarliestCapture; + return {CB.EarliestCapture, CB.CC}; } UseCaptureInfo llvm::DetermineUseCaptureKind(const Use &U, const Value *Base) { |