[llvm] Scalarizer : Fix vector shuffle issue when can't aligned to customized minBits. (PR #163912)

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 3 21:25:56 PST 2025


================
@@ -252,14 +252,30 @@ static Value *concatenate(IRBuilder<> &Builder, ArrayRef<Value *> Fragments,
       Res = Builder.CreateInsertElement(Res, Fragment, I * VS.NumPacked,
                                         Name + ".upto" + Twine(I));
     } else {
+      if (NumPacked < VS.NumPacked) {
+        // If last pack of remained bits not aligned to target pack size.
+        ExtendMask.resize(NumPacked);
+      }
+
       Fragment = Builder.CreateShuffleVector(Fragment, Fragment, ExtendMask);
----------------
ShchchowAMD wrote:

Hi, I think I made a mistake in test example, when minbits=4 and vector size is 7, this issue seems not able to be reproduced.

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


More information about the llvm-commits mailing list