@@ -805,8 +805,8 @@ static VPValue *optimizeEarlyExitInductionUser(VPlan &Plan,
805805 VPValue *Op,
806806 ScalarEvolution &SE) {
807807 VPValue *Incoming, *Mask;
808- if (!match (Op, m_ExtractLane ( m_FirstActiveLane ( m_VPValue (Mask)),
809- m_VPValue (Incoming))))
808+ if (!match (Op, m_VPInstruction<VPInstruction::ExtractLane>(
809+ m_FirstActiveLane ( m_VPValue (Mask)), m_VPValue (Incoming))))
810810 return nullptr ;
811811
812812 auto *WideIV = getOptimizableIVOf (Incoming, SE);
@@ -1274,7 +1274,8 @@ static void simplifyRecipe(VPSingleDefRecipe *Def, VPTypeAnalysis &TypeInfo) {
12741274 }
12751275
12761276 // Look through ExtractPenultimateElement (BuildVector ....).
1277- if (match (Def, m_ExtractPenultimateElement (m_BuildVector ()))) {
1277+ if (match (Def, m_VPInstruction<VPInstruction::ExtractPenultimateElement>(
1278+ m_BuildVector ()))) {
12781279 auto *BuildVector = cast<VPInstruction>(Def->getOperand (0 ));
12791280 Def->replaceAllUsesWith (
12801281 BuildVector->getOperand (BuildVector->getNumOperands () - 2 ));
@@ -2085,32 +2086,6 @@ bool VPlanTransforms::adjustFixedOrderRecurrences(VPlan &Plan,
20852086 // Set the first operand of RecurSplice to FOR again, after replacing
20862087 // all users.
20872088 RecurSplice->setOperand (0 , FOR);
2088-
2089- // Check for users extracting at the penultimate active lane of the FOR.
2090- // If only a single lane is active in the current iteration, we need to
2091- // select the last element from the previous iteration (from the FOR phi
2092- // directly).
2093- for (VPUser *U : RecurSplice->users ()) {
2094- if (!match (U, m_ExtractLane (m_LastActiveLane (m_VPValue ()),
2095- m_Specific (RecurSplice))))
2096- continue ;
2097-
2098- VPBuilder B (cast<VPInstruction>(U));
2099- VPValue *LastActiveLane = cast<VPInstruction>(U)->getOperand (0 );
2100- Type *I64Ty = Type::getInt64Ty (Plan.getContext ());
2101- VPValue *Zero = Plan.getOrAddLiveIn (ConstantInt::get (I64Ty, 0 ));
2102- VPValue *One = Plan.getOrAddLiveIn (ConstantInt::get (I64Ty, 1 ));
2103- VPValue *PenultimateIndex =
2104- B.createNaryOp (Instruction::Sub, {LastActiveLane, One});
2105- VPValue *PenultimateLastIter =
2106- B.createNaryOp (VPInstruction::ExtractLane,
2107- {PenultimateIndex, FOR->getBackedgeValue ()});
2108- VPValue *LastPrevIter =
2109- B.createNaryOp (VPInstruction::ExtractLastElement, FOR);
2110- VPValue *Cmp = B.createICmp (CmpInst::ICMP_EQ, LastActiveLane, Zero);
2111- VPValue *Sel = B.createSelect (Cmp, LastPrevIter, PenultimateLastIter);
2112- cast<VPInstruction>(U)->replaceAllUsesWith (Sel);
2113- }
21142089 }
21152090 return true ;
21162091}
@@ -3500,34 +3475,6 @@ void VPlanTransforms::convertToConcreteRecipes(VPlan &Plan) {
35003475 ToRemove.push_back (Expr);
35013476 }
35023477
3503- // Expand LastActiveLane into Not + FirstActiveLane + Sub.
3504- auto *LastActiveL = dyn_cast<VPInstruction>(&R);
3505- if (LastActiveL &&
3506- LastActiveL->getOpcode () == VPInstruction::LastActiveLane) {
3507- // Create Not(Mask) for all operands.
3508- SmallVector<VPValue *, 2 > NotMasks;
3509- for (VPValue *Op : LastActiveL->operands ()) {
3510- VPValue *NotMask = Builder.createNot (Op, LastActiveL->getDebugLoc ());
3511- NotMasks.push_back (NotMask);
3512- }
3513-
3514- // Create FirstActiveLane on the inverted masks.
3515- VPValue *FirstInactiveLane = Builder.createNaryOp (
3516- VPInstruction::FirstActiveLane, NotMasks,
3517- LastActiveL->getDebugLoc (), " first.inactive.lane" );
3518-
3519- // Subtract 1 to get the last active lane.
3520- VPValue *One = Plan.getOrAddLiveIn (
3521- ConstantInt::get (Type::getInt64Ty (Plan.getContext ()), 1 ));
3522- VPValue *LastLane = Builder.createNaryOp (
3523- Instruction::Sub, {FirstInactiveLane, One},
3524- LastActiveL->getDebugLoc (), " last.active.lane" );
3525-
3526- LastActiveL->replaceAllUsesWith (LastLane);
3527- ToRemove.push_back (LastActiveL);
3528- continue ;
3529- }
3530-
35313478 VPValue *VectorStep;
35323479 VPValue *ScalarStep;
35333480 if (!match (&R, m_VPInstruction<VPInstruction::WideIVStep>(
0 commit comments