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

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 1 21:35:14 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);
----------------
nhaehnle wrote:

This shuffle is meant to always extend, so it should use `poison` as its second vector argument.

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


More information about the llvm-commits mailing list