@@ -2437,14 +2437,6 @@ class VPExtendedReductionRecipe : public VPReductionRecipe {
2437
2437
// / Opcode of the extend recipe will be lowered to.
2438
2438
Instruction::CastOps ExtOp;
2439
2439
2440
- public:
2441
- VPExtendedReductionRecipe (VPReductionRecipe *R, VPWidenCastRecipe *Ext)
2442
- : VPReductionRecipe(VPDef::VPExtendedReductionSC,
2443
- R->getRecurrenceDescriptor (),
2444
- {R->getChainOp (), Ext->getOperand (0 )}, R->getCondOp (),
2445
- R->isOrdered(), Ext->isNonNeg(), Ext->getDebugLoc()),
2446
- ExtOp(Ext->getOpcode ()) {}
2447
-
2448
2440
// / For cloning VPExtendedReductionRecipe.
2449
2441
VPExtendedReductionRecipe (VPExtendedReductionRecipe *ExtRed)
2450
2442
: VPReductionRecipe(
@@ -2453,6 +2445,14 @@ class VPExtendedReductionRecipe : public VPReductionRecipe {
2453
2445
ExtRed->isOrdered(), ExtRed->isNonNeg(), ExtRed->getDebugLoc()),
2454
2446
ExtOp(ExtRed->getExtOpcode ()) {}
2455
2447
2448
+ public:
2449
+ VPExtendedReductionRecipe (VPReductionRecipe *R, VPWidenCastRecipe *Ext)
2450
+ : VPReductionRecipe(VPDef::VPExtendedReductionSC,
2451
+ R->getRecurrenceDescriptor (),
2452
+ {R->getChainOp (), Ext->getOperand (0 )}, R->getCondOp (),
2453
+ R->isOrdered(), Ext->isNonNeg(), Ext->getDebugLoc()),
2454
+ ExtOp(Ext->getOpcode ()) {}
2455
+
2456
2456
~VPExtendedReductionRecipe () override = default ;
2457
2457
2458
2458
VPExtendedReductionRecipe *clone () override {
@@ -2500,8 +2500,16 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
2500
2500
// / Non-neg flag of the extend recipe.
2501
2501
bool IsNonNeg = false ;
2502
2502
2503
- // / Is this multiply-accumulate-reduction recipe contains extend?
2504
- bool IsExtended = false ;
2503
+ // / For cloning VPMulAccumulateReductionRecipe.
2504
+ VPMulAccumulateReductionRecipe (VPMulAccumulateReductionRecipe *MulAcc)
2505
+ : VPReductionRecipe(
2506
+ VPDef::VPMulAccumulateReductionSC,
2507
+ MulAcc->getRecurrenceDescriptor (),
2508
+ {MulAcc->getChainOp (), MulAcc->getVecOp0 (), MulAcc->getVecOp1 ()},
2509
+ MulAcc->getCondOp (), MulAcc->isOrdered(),
2510
+ MulAcc->hasNoUnsignedWrap(), MulAcc->hasNoSignedWrap(),
2511
+ MulAcc->getDebugLoc()),
2512
+ ExtOp(MulAcc->getExtOpcode ()), IsNonNeg(MulAcc->isNonNeg ()) {}
2505
2513
2506
2514
public:
2507
2515
VPMulAccumulateReductionRecipe (VPReductionRecipe *R, VPWidenRecipe *Mul,
@@ -2516,32 +2524,20 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
2516
2524
assert (getRecurrenceDescriptor ().getOpcode () == Instruction::Add &&
2517
2525
" The reduction instruction in MulAccumulateteReductionRecipe must "
2518
2526
" be Add" );
2519
- IsExtended = true ;
2520
2527
}
2521
2528
2522
2529
VPMulAccumulateReductionRecipe (VPReductionRecipe *R, VPWidenRecipe *Mul)
2523
2530
: VPReductionRecipe(
2524
2531
VPDef::VPMulAccumulateReductionSC, R->getRecurrenceDescriptor (),
2525
2532
{R->getChainOp (), Mul->getOperand (0 ), Mul->getOperand (1 )},
2526
2533
R->getCondOp (), R->isOrdered(), Mul->hasNoUnsignedWrap(),
2527
- Mul->hasNoSignedWrap(), R->getDebugLoc()) {
2534
+ Mul->hasNoSignedWrap(), R->getDebugLoc()),
2535
+ ExtOp(Instruction::CastOps::CastOpsEnd) {
2528
2536
assert (getRecurrenceDescriptor ().getOpcode () == Instruction::Add &&
2529
2537
" The reduction instruction in MulAccumulateReductionRecipe must be "
2530
2538
" Add" );
2531
2539
}
2532
2540
2533
- // / For cloning VPMulAccumulateReductionRecipe.
2534
- VPMulAccumulateReductionRecipe (VPMulAccumulateReductionRecipe *MulAcc)
2535
- : VPReductionRecipe(
2536
- VPDef::VPMulAccumulateReductionSC,
2537
- MulAcc->getRecurrenceDescriptor (),
2538
- {MulAcc->getChainOp (), MulAcc->getVecOp0 (), MulAcc->getVecOp1 ()},
2539
- MulAcc->getCondOp (), MulAcc->isOrdered(),
2540
- MulAcc->hasNoUnsignedWrap(), MulAcc->hasNoSignedWrap(),
2541
- MulAcc->getDebugLoc()),
2542
- ExtOp(MulAcc->getExtOpcode ()), IsNonNeg(MulAcc->isNonNeg ()),
2543
- IsExtended(MulAcc->isExtended ()) {}
2544
-
2545
2541
~VPMulAccumulateReductionRecipe () override = default ;
2546
2542
2547
2543
VPMulAccumulateReductionRecipe *clone () override {
@@ -2571,7 +2567,7 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
2571
2567
VPValue *getVecOp1 () const { return getOperand (2 ); }
2572
2568
2573
2569
// / Return if this MulAcc recipe contains extend instructions.
2574
- bool isExtended () const { return IsExtended ; }
2570
+ bool isExtended () const { return ExtOp != Instruction::CastOps::CastOpsEnd ; }
2575
2571
2576
2572
// / Return if the operands of mul instruction come from same extend.
2577
2573
bool isSameExtend () const { return getVecOp0 () == getVecOp1 (); }
@@ -2580,11 +2576,7 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
2580
2576
Instruction::CastOps getExtOpcode () const { return ExtOp; }
2581
2577
2582
2578
// / Return if the extend opcode is ZExt.
2583
- bool isZExt () const {
2584
- if (!isExtended ())
2585
- return true ;
2586
- return ExtOp == Instruction::CastOps::ZExt;
2587
- }
2579
+ bool isZExt () const { return ExtOp == Instruction::CastOps::ZExt; }
2588
2580
2589
2581
// / Return the non negative flag of the ext recipe.
2590
2582
bool isNonNeg () const { return IsNonNeg; }
0 commit comments