diff options
author | Nikita Popov <npopov@redhat.com> | 2025-05-22 17:01:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-22 17:01:37 +0200 |
commit | eee958285bde228df2893f70f879c1af8ec8386c (patch) | |
tree | 691bd0e51e81486d22b6e6b92d5eb39dde349836 /llvm/lib | |
parent | fb21efa258d84a159a5951c3cc8184edfe5ba796 (diff) | |
download | llvm-eee958285bde228df2893f70f879c1af8ec8386c.zip llvm-eee958285bde228df2893f70f879c1af8ec8386c.tar.gz llvm-eee958285bde228df2893f70f879c1af8ec8386c.tar.bz2 |
[SimplifyCFG] Only consider provenance capture in store speculation (#138548)
The capture check here is to protect against concurrent accesses from
other threads. This requires the provenance to escape.
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index d94abea..7840601 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -3067,7 +3067,9 @@ static Value *isSafeToSpeculateStore(Instruction *I, BasicBlock *BrBB, Value *Obj = getUnderlyingObject(StorePtr); bool ExplicitlyDereferenceableOnly; if (isWritableObject(Obj, ExplicitlyDereferenceableOnly) && - !PointerMayBeCaptured(Obj, /*ReturnCaptures=*/false) && + capturesNothing( + PointerMayBeCaptured(Obj, /*ReturnCaptures=*/false, + CaptureComponents::Provenance)) && (!ExplicitlyDereferenceableOnly || isDereferenceablePointer(StorePtr, StoreTy, LI->getDataLayout()))) { |