[VPlan] Don't compute costs if there are no vector VPlans.

In some cases, no vector VPlans can be constructed due to failing VPlan
legality checks (e.g. unable to perform sinking for first order
recurrences or plans being incompatible with EVL).

There's no need to compute costs in those cases, so check directly if
there are no vector plans.
This commit is contained in:
Florian Hahn
2024-06-24 08:38:31 +01:00
parent 9931ee61d9
commit abf5969f76
2 changed files with 3 additions and 3 deletions

View File

@@ -7294,7 +7294,8 @@ LoopVectorizationPlanner::plan(ElementCount UserVF, unsigned UserIC) {
buildVPlansWithVPRecipes(ElementCount::getScalable(1), MaxFactors.ScalableVF);
LLVM_DEBUG(printPlans(dbgs()));
if (!MaxFactors.hasVector())
if (all_of(VPlans,
[](std::unique_ptr<VPlan> &P) { return P->hasScalarVFOnly(); }))
return VectorizationFactor::Disabled();
// Select the optimal vectorization factor.

View File

@@ -5,9 +5,8 @@
; REQUIRES: asserts
; Make sure we do not vectorize a loop with a widened int induction.
; TODO: There's no need to compute costs for any VF, as no VPlans have been generated.
define void @test_wide_integer_induction(ptr noalias %a, i64 %N) {
; CHECK: LV: Vector loop of width {{.+}} costs:
; CHECK-NOT: LV: Vector loop of width {{.+}} costs:
;
; CHECK: define void @test_wide_integer_induction(
; CHECK-NOT: vector.body