[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
Fri Dec 5 12:53:41 PST 2025


================
@@ -252,7 +252,14 @@ static Value *concatenate(IRBuilder<> &Builder, ArrayRef<Value *> Fragments,
       Res = Builder.CreateInsertElement(Res, Fragment, I * VS.NumPacked,
                                         Name + ".upto" + Twine(I));
     } else {
-      Fragment = Builder.CreateShuffleVector(Fragment, Fragment, ExtendMask);
+      if (NumPacked <= VS.NumPacked / 2) {
----------------
nhaehnle wrote:

```suggestion
      if (NumPacked < VS.NumPacked) {
```
This is more of a nit, but if we don't do that, a later InstCombine ought to canonicalize the shuffle to that form, and so we may as well create it directly in this canonical form.

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


More information about the llvm-commits mailing list