[llvm] [LLVM][CodeGen] Ensure optimizeIncrementingWhile only accepts scalable vectors. (PR #148351)

Ricardo Jesus via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 12 06:58:53 PDT 2025


================
@@ -5509,7 +5509,8 @@ static SDValue optimizeIncrementingWhile(SDNode *N, SelectionDAG &DAG,
   unsigned Op0 = N->getOpcode() == ISD::INTRINSIC_WO_CHAIN ? 1 : 0;
   unsigned Op1 = N->getOpcode() == ISD::INTRINSIC_WO_CHAIN ? 2 : 1;
 
-  if (!isa<ConstantSDNode>(N->getOperand(Op1)))
+  if (!N->getValueType(0).isScalableVector() ||
----------------
rj-jesus wrote:

Would it make sense to do this check in `performActiveLaneMaskCombine` instead? I think for fixed length vectors this can't be reached from anywhere else, and we already have a similar check there which perhaps we could reuse.

If we do keep it here, it may still be worth moving it a few lines below to the `if (!isa<ConstantSDNode>(N->getOperand(Op0)))` in case we ever call this for fixed length vectors with `IsEqual = true`.

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


More information about the llvm-commits mailing list