[llvm] [RISCV] Add DAG combine to convert (iN reduce.add (zext (vXi1 A to vXiN)) into vcpop.m (PR #127497)
Sergey Kachkov via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 21 01:16:05 PST 2025
================
@@ -18128,11 +18141,28 @@ static SDValue combineScalarCTPOPToVCPOP(SDNode *N, SelectionDAG &DAG,
if (!SrcMVT.isVector() || SrcMVT.getVectorElementType() != MVT::i1)
return SDValue();
- if (!useRVVForFixedLengthVectorVT(SrcMVT, Subtarget))
- return SDValue();
+ // Check that destination type is large enough to hold result without
+ // overflow.
+ if (Opc == ISD::VECREDUCE_ADD) {
+ unsigned EltSize = SrcMVT.getScalarSizeInBits();
+ unsigned MinSize = SrcMVT.getSizeInBits().getKnownMinValue();
+ unsigned VectorBitsMax = Subtarget.getRealMaxVLen();
+ unsigned MaxVLMAX = SrcMVT.isFixedLengthVector()
----------------
skachkov-sc wrote:
Added (BTW, I think it will be a rare case on practice because InstCombine converts zext+reduce.add with fixed vector to bitcast + ctpop)
https://github.com/llvm/llvm-project/pull/127497
More information about the llvm-commits
mailing list