From c21ccebe6f5293fc1359456b31d188edc9c5ac66 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Mon, 20 Feb 2023 14:11:18 +0000 Subject: [PATCH] [VPlan] Use usesScalars in shouldPack. Suggested by @Ayal as follow-up improvement in D143864. I was unable to find a case where this actually changes generated code, but it is a unifying code to use common infrastructure. --- llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp index 0e5dee7..951ea8a 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp @@ -926,8 +926,9 @@ 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(), - [](const VPUser *U) { return !isa(U); }); + return any_of(PredR->users(), [PredR](const VPUser *U) { + return !U->usesScalars(PredR); + }); return false; }); } -- 2.7.4