@@ -316,7 +316,7 @@ static bool mergeReplicateRegionsIntoSuccessors(VPlan &Plan) {
316316 });
317317
318318 // Remove phi recipes that are unused after merging the regions.
319- if (Phi1ToMove.getVPSingleValue ()->getNumUsers () == 0 ) {
319+ if (Phi1ToMove.getVPSingleValue ()->hasNoUsers () ) {
320320 Phi1ToMove.eraseFromParent ();
321321 continue ;
322322 }
@@ -363,7 +363,7 @@ static VPRegionBlock *createReplicateRegion(VPReplicateRecipe *PredRecipe,
363363 Plan.createVPBasicBlock (Twine (RegionName) + " .if" , RecipeWithoutMask);
364364
365365 VPPredInstPHIRecipe *PHIRecipe = nullptr ;
366- if (PredRecipe->getNumUsers () != 0 ) {
366+ if (! PredRecipe->hasNoUsers () ) {
367367 PHIRecipe = new VPPredInstPHIRecipe (RecipeWithoutMask,
368368 RecipeWithoutMask->getDebugLoc ());
369369 PredRecipe->replaceAllUsesWith (PHIRecipe);
@@ -546,8 +546,7 @@ static bool isDeadRecipe(VPRecipeBase &R) {
546546 return false ;
547547
548548 // Recipe is dead if no user keeps the recipe alive.
549- return all_of (R.definedValues (),
550- [](VPValue *V) { return V->getNumUsers () == 0 ; });
549+ return all_of (R.definedValues (), [](VPValue *V) { return V->hasNoUsers (); });
551550}
552551
553552void VPlanTransforms::removeDeadRecipes (VPlan &Plan) {
@@ -563,11 +562,11 @@ void VPlanTransforms::removeDeadRecipes(VPlan &Plan) {
563562
564563 // Check if R is a dead VPPhi <-> update cycle and remove it.
565564 auto *PhiR = dyn_cast<VPPhi>(&R);
566- if (!PhiR || PhiR->getNumOperands () != 2 || PhiR->getNumUsers () != 1 )
565+ if (!PhiR || PhiR->getNumOperands () != 2 || ! PhiR->hasOneUser () )
567566 continue ;
568567 VPValue *Incoming = PhiR->getOperand (1 );
569568 if (*PhiR->user_begin () != Incoming->getDefiningRecipe () ||
570- Incoming->getNumUsers () != 1 )
569+ ! Incoming->hasOneUser () )
571570 continue ;
572571 PhiR->replaceAllUsesWith (PhiR->getOperand (0 ));
573572 PhiR->eraseFromParent ();
@@ -658,7 +657,7 @@ static void legalizeAndOptimizeInductions(VPlan &Plan) {
658657 auto *RepR = dyn_cast<VPReplicateRecipe>(U);
659658 // Skip recipes that shouldn't be narrowed.
660659 if (!Def || !isa<VPReplicateRecipe, VPWidenRecipe>(Def) ||
661- Def->getNumUsers () == 0 || !Def->getUnderlyingValue () ||
660+ Def->hasNoUsers () || !Def->getUnderlyingValue () ||
662661 (RepR && (RepR->isSingleScalar () || RepR->isPredicated ())))
663662 continue ;
664663
@@ -1103,8 +1102,8 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
11031102 m_LogicalAnd (m_Deferred (X), m_VPValue (Z)))) &&
11041103 // Simplify only if one of the operands has one use to avoid creating an
11051104 // extra recipe.
1106- (! Def->getOperand (0 )->hasMoreThanOneUniqueUser () ||
1107- ! Def->getOperand (1 )->hasMoreThanOneUniqueUser ()))
1105+ (Def->getOperand (0 )->hasNoOrOneUser () ||
1106+ Def->getOperand (1 )->hasNoOrOneUser ()))
11081107 return Def->replaceAllUsesWith (
11091108 Builder.createLogicalAnd (X, Builder.createOr (Y, Z)));
11101109
@@ -1130,7 +1129,7 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
11301129 // further.
11311130 if (match (Def, m_LogicalAnd (m_LogicalAnd (m_VPValue (X), m_VPValue (Y)),
11321131 m_VPValue (Z))) &&
1133- X->hasMoreThanOneUniqueUser ())
1132+ ! X->hasNoOrOneUser ())
11341133 return Def->replaceAllUsesWith (
11351134 Builder.createLogicalAnd (X, Builder.createLogicalAnd (Y, Z)));
11361135
@@ -1383,7 +1382,7 @@ static void simplifyBlends(VPlan &Plan) {
13831382 // TODO: Find the most expensive mask that can be deadcoded, or a mask
13841383 // that's used by multiple blends where it can be removed from them all.
13851384 VPValue *Mask = Blend->getMask (I);
1386- if (Mask->getNumUsers () == 1 && !match (Mask, m_False ())) {
1385+ if (Mask->hasOneUser () && !match (Mask, m_False ())) {
13871386 StartIndex = I;
13881387 break ;
13891388 }
@@ -1419,7 +1418,7 @@ static void simplifyBlends(VPlan &Plan) {
14191418 NewBlend->setOperand (0 , Inc1);
14201419 NewBlend->setOperand (1 , Inc0);
14211420 NewBlend->setOperand (2 , NewMask);
1422- if (OldMask->getNumUsers () == 0 )
1421+ if (OldMask->hasNoUsers () )
14231422 cast<VPInstruction>(OldMask)->eraseFromParent ();
14241423 }
14251424 }
@@ -1466,8 +1465,7 @@ static bool optimizeVectorInductionWidthForTCAndVFUF(VPlan &Plan,
14661465 // Currently only handle canonical IVs as it is trivial to replace the start
14671466 // and stop values, and we currently only perform the optimization when the
14681467 // IV has a single use.
1469- if (!WideIV || !WideIV->isCanonical () ||
1470- WideIV->hasMoreThanOneUniqueUser () ||
1468+ if (!WideIV || !WideIV->isCanonical () || !WideIV->hasNoOrOneUser () ||
14711469 NewIVTy == WideIV->getScalarType ())
14721470 continue ;
14731471
@@ -2611,7 +2609,7 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
26112609 ToErase.push_back (CurRecipe);
26122610 }
26132611 // Remove dead EVL mask.
2614- if (EVLMask->getNumUsers () == 0 )
2612+ if (EVLMask->hasNoUsers () )
26152613 ToErase.push_back (EVLMask->getDefiningRecipe ());
26162614
26172615 for (VPRecipeBase *R : reverse (ToErase)) {
@@ -3590,7 +3588,7 @@ void VPlanTransforms::materializeBroadcasts(VPlan &Plan) {
35903588#endif
35913589
35923590 SmallVector<VPValue *> VPValues;
3593- if (Plan.getOrCreateBackedgeTakenCount ()->getNumUsers () > 0 )
3591+ if (Plan.getOrCreateBackedgeTakenCount ()->hasUsers () )
35943592 VPValues.push_back (Plan.getOrCreateBackedgeTakenCount ());
35953593 append_range (VPValues, Plan.getLiveIns ());
35963594 for (VPRecipeBase &R : *Plan.getEntry ())
@@ -3659,7 +3657,7 @@ void VPlanTransforms::materializeConstantVectorTripCount(
36593657void VPlanTransforms::materializeBackedgeTakenCount (VPlan &Plan,
36603658 VPBasicBlock *VectorPH) {
36613659 VPValue *BTC = Plan.getOrCreateBackedgeTakenCount ();
3662- if (BTC->getNumUsers () == 0 )
3660+ if (BTC->hasNoUsers () )
36633661 return ;
36643662
36653663 VPBuilder Builder (VectorPH, VectorPH->begin ());
@@ -3725,7 +3723,7 @@ void VPlanTransforms::materializeVectorTripCount(VPlan &Plan,
37253723 assert (VectorTC.isLiveIn () && " vector-trip-count must be a live-in" );
37263724 // There's nothing to do if there are no users of the vector trip count or its
37273725 // IR value has already been set.
3728- if (VectorTC.getNumUsers () == 0 || VectorTC.getLiveInIRValue ())
3726+ if (VectorTC.hasNoUsers () || VectorTC.getLiveInIRValue ())
37293727 return ;
37303728
37313729 VPValue *TC = Plan.getTripCount ();
@@ -3790,7 +3788,7 @@ void VPlanTransforms::materializeVFAndVFxUF(VPlan &Plan, VPBasicBlock *VectorPH,
37903788
37913789 // If there are no users of the runtime VF, compute VFxUF by constant folding
37923790 // the multiplication of VF and UF.
3793- if (VF.getNumUsers () == 0 ) {
3791+ if (VF.hasNoUsers () ) {
37943792 VPValue *RuntimeVFxUF =
37953793 Builder.createElementCount (TCTy, VFEC * Plan.getUF ());
37963794 VFxUF.replaceAllUsesWith (RuntimeVFxUF);
0 commit comments