Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mshockwave opened this issue Nov 11, 2024 · 2 comments · Fixed by #115705
Closed

Comments

@mshockwave
Copy link
Member

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
@llvmbot
Copy link
Member

llvmbot commented Nov 11, 2024

@llvm/issue-subscribers-backend-risc-v

Author: Min-Yih Hsu (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

@fhahn
Copy link
Contributor

fhahn commented Nov 11, 2024

Fix is discussed here: #115705

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants