@@ -2635,6 +2635,10 @@ class VPExtendedReductionRecipe : public VPReductionRecipe {
26352635 {R->getChainOp (), Ext->getOperand (0 )}, R->getCondOp (),
26362636 R->isOrdered(), Ext->getDebugLoc()),
26372637 ExtOp(Ext->getOpcode ()), ResultTy(Ext->getResultType ()) {
2638+ assert ((ExtOp == Instruction::CastOps::ZExt ||
2639+ ExtOp == Instruction::CastOps::SExt) &&
2640+ " VPExtendedReductionRecipe only support zext and sext." );
2641+
26382642 // Not all WidenCastRecipes contain nneg flag. Need to transfer flags from
26392643 // the original recipe to prevent setting wrong flags.
26402644 transferFlags (*Ext);
@@ -2643,9 +2647,7 @@ class VPExtendedReductionRecipe : public VPReductionRecipe {
26432647 ~VPExtendedReductionRecipe () override = default ;
26442648
26452649 VPExtendedReductionRecipe *clone () override {
2646- auto *Copy = new VPExtendedReductionRecipe (this );
2647- Copy->transferFlags (*this );
2648- return Copy;
2650+ return new VPExtendedReductionRecipe (this );
26492651 }
26502652
26512653 VP_CLASSOF_IMPL (VPDef::VPExtendedReductionSC);
@@ -2715,6 +2717,9 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
27152717 Instruction::Add &&
27162718 " The reduction instruction in MulAccumulateteReductionRecipe must "
27172719 " be Add" );
2720+ assert ((ExtOp == Instruction::CastOps::ZExt ||
2721+ ExtOp == Instruction::CastOps::SExt) &&
2722+ " VPMulAccumulateReductionRecipe only support zext and sext." );
27182723 // Only set the non-negative flag if the original recipe contains.
27192724 if (Ext0->hasNonNegFlag ())
27202725 IsNonNeg = Ext0->isNonNeg ();
0 commit comments