diff --git a/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp b/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp index b39231f106300..716814b84f487 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp @@ -557,11 +557,7 @@ SmallVector llvm::calculateRegisterUsageForPlan( isa(R) || (isa(R) && - all_of(cast(R)->users(), - [&](VPUser *U) { - return cast(U)->usesScalars( - R->getVPSingleValue()); - })) || + vputils::onlyScalarValuesUsed(cast(R))) || (isa(R) && (cast(R))->isInLoop())) { unsigned ClassID = TTI.getRegisterClassForType( @@ -614,9 +610,7 @@ SmallVector llvm::calculateRegisterUsageForPlan( for (auto *In : LoopInvariants) { // FIXME: The target might use more than one register for the type // even in the scalar case. - bool IsScalar = all_of(In->users(), [&](VPUser *U) { - return cast(U)->usesScalars(In); - }); + bool IsScalar = vputils::onlyScalarValuesUsed(In); ElementCount VF = IsScalar ? ElementCount::getFixed(1) : VFs[Idx]; unsigned ClassID = TTI.getRegisterClassForType( diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp index 7ca9b230f5aae..f3a188158adbe 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp @@ -2958,9 +2958,7 @@ bool VPReplicateRecipe::shouldPack() const { // VPPredInstPHIRecipe. In this case, also pack the scalar values in a vector. return any_of(users(), [](const VPUser *U) { if (auto *PredR = dyn_cast(U)) - return any_of(PredR->users(), [PredR](const VPUser *U) { - return !U->usesScalars(PredR); - }); + return !vputils::onlyScalarValuesUsed(PredR); return false; }); }