[llvm] [SLP] Bail out on store-to-load forwarding hazards (PR #199606)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 1 05:43:03 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- llvm/include/llvm/Analysis/LoopAccessAnalysis.h llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h llvm/lib/Analysis/LoopAccessAnalysis.cpp llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
index 442a9746c..a58c28c1d 100644
--- a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
+++ b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
@@ -61,8 +61,7 @@ struct VectorizerParams {
                                                    uint64_t VectorStoreSize,
                                                    uint64_t TypeByteSize) {
     const uint64_t NumItersForStoreLoadThroughMemory = 8 * TypeByteSize;
-    return VectorStoreSize != 0 &&
-           Distance % VectorStoreSize != 0 &&
+    return VectorStoreSize != 0 && Distance % VectorStoreSize != 0 &&
            Distance / VectorStoreSize < NumItersForStoreLoadThroughMemory;
   }
 
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 995faa73c..26e8d00f7 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -27468,10 +27468,10 @@ bool SLPVectorizerPass::hasStoreLoadForwardingConflict(ArrayRef<Value *> Chain,
     // the specific store LAA paired with the load: LAA may pick any chain
     // store as the dependence representative, but the predicate cares about
     // the chain window's start.
-    std::optional<int64_t> Diff = getPointersDiff(
-        ValueTy, FirstStore->getPointerOperand(), LoadI->getType(),
-        LoadI->getPointerOperand(), *DL, *SE,
-        /*StrictCheck=*/false, /*CheckType=*/false);
+    std::optional<int64_t> Diff =
+        getPointersDiff(ValueTy, FirstStore->getPointerOperand(),
+                        LoadI->getType(), LoadI->getPointerOperand(), *DL, *SE,
+                        /*StrictCheck=*/false, /*CheckType=*/false);
     if (!Diff) {
       LLVM_DEBUG(dbgs() << "SLP: STLF: getPointersDiff returned nullopt\n");
       continue;

``````````

</details>


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


More information about the llvm-commits mailing list