Skip to content

Commit 77da697

Browse files
committed
Fixup, Address comments.
1 parent a60385c commit 77da697

File tree

1 file changed

+8
-3
lines changed
  • llvm/lib/Transforms/Vectorize

1 file changed

+8
-3
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2579,6 +2579,10 @@ class VPExtendedReductionRecipe : public VPReductionRecipe {
25792579
{R->getChainOp(), Ext->getOperand(0)}, R->getCondOp(),
25802580
R->isOrdered(), Ext->getDebugLoc()),
25812581
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+
25822586
// Not all WidenCastRecipes contain nneg flag. Need to transfer flags from
25832587
// the original recipe to prevent setting wrong flags.
25842588
transferFlags(*Ext);
@@ -2587,9 +2591,7 @@ class VPExtendedReductionRecipe : public VPReductionRecipe {
25872591
~VPExtendedReductionRecipe() override = default;
25882592

25892593
VPExtendedReductionRecipe *clone() override {
2590-
auto *Copy = new VPExtendedReductionRecipe(this);
2591-
Copy->transferFlags(*this);
2592-
return Copy;
2594+
return new VPExtendedReductionRecipe(this);
25932595
}
25942596

25952597
VP_CLASSOF_IMPL(VPDef::VPExtendedReductionSC);
@@ -2659,6 +2661,9 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
26592661
Instruction::Add &&
26602662
"The reduction instruction in MulAccumulateteReductionRecipe must "
26612663
"be Add");
2664+
assert((ExtOp == Instruction::CastOps::ZExt ||
2665+
ExtOp == Instruction::CastOps::SExt) &&
2666+
"VPMulAccumulateReductionRecipe only support zext and sext.");
26622667
// Only set the non-negative flag if the original recipe contains.
26632668
if (Ext0->hasNonNegFlag())
26642669
IsNonNeg = Ext0->isNonNeg();

0 commit comments

Comments
 (0)