[llvm] [VectorCombine] fix division by zero in foldSelectShuffle (PR #156779)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 4 05:00:39 PDT 2025


================
@@ -3900,7 +3900,8 @@ bool VectorCombine::foldSelectShuffle(Instruction &I, bool FromReduction) {
   unsigned ElementSize = VT->getElementType()->getPrimitiveSizeInBits();
   unsigned MaxVectorSize =
       TTI.getRegisterBitWidth(TargetTransformInfo::RGK_FixedWidthVector);
-  unsigned MaxElementsInVector = MaxVectorSize / ElementSize;
+  unsigned MaxElementsInVector =
----------------
dtcxzyw wrote:

Can we early exit if `MaxElementsInVector <= 1`? The trivial case isn't profitable.

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


More information about the llvm-commits mailing list