Skip to content

[LV][VPlan] Crash: " VPlan cost model and legacy cost model disagreed" #161404

@alexey-bataev

Description

@alexey-bataev
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define void @test(ptr %0, ptr %1, ptr %2) #0 {
bb:
  %3 = load i32, ptr %0, align 4
  %omp_loop.cmp2515.not = icmp slt i32 %3, 1
  br i1 %omp_loop.cmp2515.not, label %common.ret, label %ph

ph:
  %wide.trip.count = zext i32 %3 to i64
  br label %body

body:
  %indvars.iv = phi i64 [ 0, %ph ], [ %indvars.iv.next, %body ]
  %indvars.iv.next = add i64 %indvars.iv, 1
  %gep.us = getelementptr i8, ptr %1, i64 %indvars.iv
  %4 = load double, ptr %gep.us, align 8
  %sext = shl i64 %indvars.iv, 1
  %5 = getelementptr i8, ptr %2, i64 %sext
  store double %4, ptr %5, align 8
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %common.ret, label %body, !llvm.loop !0

common.ret:
  ret void
}

attributes #0 = { "target-cpu"="znver2" }

!0 = distinct !{!0, !1, !3}
!1 = !{!"llvm.loop.parallel_accesses", !2}
!2 = distinct !{}
!3 = !{!"llvm.loop.vectorize.enable", i1 true}

opt --passes=loop-vectorize -S ./reduced.ll
results in

opt: llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7085: VectorizationFactor llvm::LoopVectorizationPlanner::computeBestVF(): Assertion `(BestFactor.Width == LegacyVF.Width || BestPlan.hasEarlyExit() || planContainsAdditionalSimplifications(getPlanFor(BestFactor.Width), CostCtx, OrigLoop, BestFactor.Width) || planContainsAdditionalSimplifications( getPlanFor(LegacyVF.Width), CostCtx, OrigLoop, LegacyVF.Width)) && " VPlan cost model and legacy cost model disagreed"' failed.

Looks like caused by b4be7ec, @fhahn FYI

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions