[llvm] [X86] Fix bool vector extension for non-power-of-2 sizes (PR #228921)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 5 01:56:01 PDT 2026


================
@@ -48649,6 +48649,24 @@ static SDValue combineToExtendBoolVectorInReg(
   unsigned NumElts = VT.getVectorNumElements();
   assert(NumElts == SclVT.getSizeInBits() && "Unexpected bool vector size");
 
+  // If the scalar integer doesn't split evenly into the vector element size
+  // (e.g. i12 -> v12i8), extend it to the next multiple, extend that and
+  // extract the original elements.
+  if (NumElts > EltSizeInBits && (NumElts % EltSizeInBits) != 0) {
+    unsigned WideNumElts = alignTo(NumElts, EltSizeInBits);
----------------
RKSimon wrote:

Do we need to widen manually here or could we just bail out and wait for legalization to handle it?

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


More information about the llvm-commits mailing list