Skip to content

[RISCV][LV] LoopVectorize crashed with assertion failure when enabling EVL vectorization #115755

@mshockwave

Description

@mshockwave

The EVL LoopVectorizer currently crashes on multiple SPEC2006INT benchmarks with the same assertion failures:

lib/Transforms/Vectorize/LoopVectorize.cpp:2501: void llvm::InnerLoopVectorizer::emitIterationCountCheck(BasicBlock *): Assertion `!isIndvarOverflowCheckKnownFalse(Cost, VF * UF) && !SE.isKnownPredicate(CmpInst::getInversePredicate(ICmpInst::ICMP_ULT), TC2OverflowSCEV, SE.getSCEV(Step)) && "unexpectedly proved overflow check to be known"' failed.

Here is a reproducer from 401.bzip2:

; ModuleID = 'reduced.bc'
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
target triple = "riscv64-unknown-linux-gnu"

; Function Attrs: vscale_range(2,2)
define i32 @BZ2_decompress(ptr %s, i32 %0) #0 {
entry:
  br label %for.cond1443

for.cond1443:                                     ; preds = %for.body1447, %entry
  %v1442.08 = phi i8 [ %inc1451, %for.body1447 ], [ 0, %entry ]
  %conv1444 = zext i8 %v1442.08 to i32
  %cmp1445 = icmp sgt i32 %0, %conv1444
  br i1 %cmp1445, label %for.body1447, label %while.cond1462

for.body1447:                                     ; preds = %for.cond1443
  store i8 0, ptr %s, align 1
  %inc1451 = add i8 %v1442.08, 1
  br label %for.cond1443

while.cond1462:                                   ; preds = %while.cond1462, %for.cond1443
  br label %while.cond1462
}

attributes #0 = { vscale_range(2,2) }

And here is the reproducing command:

opt -mcpu=sifive-p670 -O3 -prefer-predicate-over-epilogue=predicate-dont-vectorize input.ll

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions