[llvm] [SimplifyCFG] Only consider provenance capture in store speculation (PR #138548)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue May 6 06:20:17 PDT 2025


================
@@ -3057,7 +3057,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)) &&
----------------
dtcxzyw wrote:

Similar pattern in LICM:
https://github.com/llvm/llvm-project/blob/6a99d817204dfa39afc42f1f6a810d82f6a8794f/llvm/lib/Transforms/Scalar/LICM.cpp#L2188-L2200
https://github.com/llvm/llvm-project/blob/6a99d817204dfa39afc42f1f6a810d82f6a8794f/llvm/lib/Transforms/Scalar/LICM.cpp#L1925-L1954



https://github.com/llvm/llvm-project/pull/138548


More information about the llvm-commits mailing list