[llvm] 5b76a2e - [SLP]Correctly calculate mask for the inserted vector

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 15:18:15 PST 2025


Author: Alexey Bataev
Date: 2025-01-08T15:18:06-08:00
New Revision: 5b76a2e51bd2765ad702cc1b249b9aacac9ea44e

URL: https://github.com/llvm/llvm-project/commit/5b76a2e51bd2765ad702cc1b249b9aacac9ea44e
DIFF: https://github.com/llvm/llvm-project/commit/5b76a2e51bd2765ad702cc1b249b9aacac9ea44e.diff

LOG: [SLP]Correctly calculate mask for the inserted vector

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 0fd9893e9ae87b..36fed8937aec28 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -4972,8 +4972,8 @@ static Value *createInsertVector(
     const unsigned VecVF = getNumElements(Vec->getType());
     SmallVector<int> Mask(VecVF, PoisonMaskElem);
     std::iota(Mask.begin(), std::next(Mask.begin(), Index), 0);
-    for (unsigned I : seq<unsigned>(Index, SubVecVF))
-      Mask[I] = I - Index + VecVF;
+    for (unsigned I : seq<unsigned>(SubVecVF))
+      Mask[I + Index] = I + VecVF;
     if (Generator) {
       Vec = Generator(Vec, V, Mask);
     } else {


        


More information about the llvm-commits mailing list