[llvm] [LoadStoreVectorizer] Fill gaps in load/store chains to enable vectorization (PR #159388)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 17 08:49:42 PDT 2025


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 cpp,h -- llvm/include/llvm/Analysis/TargetTransformInfo.h llvm/include/llvm/Analysis/TargetTransformInfoImpl.h llvm/lib/Analysis/TargetTransformInfo.cpp llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.h llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
``````````

: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/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
index 04f4e9282..d452e1609 100644
--- a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
@@ -930,9 +930,7 @@ std::vector<Chain> Vectorizer::splitChainByAlignment(Chain &C) {
       }
 
       Chain ExtendingLoadsStores;
-      bool ExtendChain = IsLoadChain
-                             ? ExtendLoads
-                             : ExtendStores;
+      bool ExtendChain = IsLoadChain ? ExtendLoads : ExtendStores;
       if (ExtendChain && NumVecElems < TargetVF && NumVecElems % 2 != 0 &&
           VecElemBits >= 8) {
         // TargetVF may be a lot higher than NumVecElems,
@@ -1047,8 +1045,8 @@ bool Vectorizer::vectorizeChain(Chain &C) {
 
   // If we are left with a two-element chain, and one of the elements is an
   // extra element, we don't want to vectorize
-  if (C.size() == 2 && (ExtraElements.contains(C[0].Inst) ||
-                        ExtraElements.contains(C[1].Inst)))
+  if (C.size() == 2 &&
+      (ExtraElements.contains(C[0].Inst) || ExtraElements.contains(C[1].Inst)))
     return false;
 
   sortChainInOffsetOrder(C);

``````````

</details>


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


More information about the llvm-commits mailing list