@@ -2579,6 +2579,10 @@ class VPExtendedReductionRecipe : public VPReductionRecipe {
2579
2579
{R->getChainOp (), Ext->getOperand (0 )}, R->getCondOp (),
2580
2580
R->isOrdered(), Ext->getDebugLoc()),
2581
2581
ExtOp(Ext->getOpcode ()), ResultTy(Ext->getResultType ()) {
2582
+ assert ((ExtOp == Instruction::CastOps::ZExt ||
2583
+ ExtOp == Instruction::CastOps::SExt) &&
2584
+ " VPExtendedReductionRecipe only support zext and sext." );
2585
+
2582
2586
// Not all WidenCastRecipes contain nneg flag. Need to transfer flags from
2583
2587
// the original recipe to prevent setting wrong flags.
2584
2588
transferFlags (*Ext);
@@ -2587,9 +2591,7 @@ class VPExtendedReductionRecipe : public VPReductionRecipe {
2587
2591
~VPExtendedReductionRecipe () override = default ;
2588
2592
2589
2593
VPExtendedReductionRecipe *clone () override {
2590
- auto *Copy = new VPExtendedReductionRecipe (this );
2591
- Copy->transferFlags (*this );
2592
- return Copy;
2594
+ return new VPExtendedReductionRecipe (this );
2593
2595
}
2594
2596
2595
2597
VP_CLASSOF_IMPL (VPDef::VPExtendedReductionSC);
@@ -2659,6 +2661,9 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
2659
2661
Instruction::Add &&
2660
2662
" The reduction instruction in MulAccumulateteReductionRecipe must "
2661
2663
" be Add" );
2664
+ assert ((ExtOp == Instruction::CastOps::ZExt ||
2665
+ ExtOp == Instruction::CastOps::SExt) &&
2666
+ " VPMulAccumulateReductionRecipe only support zext and sext." );
2662
2667
// Only set the non-negative flag if the original recipe contains.
2663
2668
if (Ext0->hasNonNegFlag ())
2664
2669
IsNonNeg = Ext0->isNonNeg ();
0 commit comments