[llvm] [VPlan] Implement VPWidenCallRecipe::computeCost (NFCI). (PR #106047)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 3 11:23:01 PDT 2024


aeubanks wrote:

this is causing crashes on

```
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "aarch64-unknown-linux-android26"

define fastcc void @selfguided_filter(ptr %arrayidx32, ptr %dav1d_sgr_x_by_x) {
entry:
  %sumsq = alloca [26520 x i32], i32 0, align 4
  br label %for.body27

for.cond22.for.cond.cleanup26_crit_edge:          ; preds = %for.body27
  ret void

for.body27:                                       ; preds = %for.body27, %entry
  %indvars.iv1 = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body27 ]
  %0 = load i32, ptr %arrayidx32, align 4
  %cond.i = tail call i32 @llvm.smax.i32(i32 %0, i32 0)
  %cond.i186 = tail call i32 @llvm.umin.i32(i32 %cond.i, i32 1)
  %idxprom45 = zext i32 %cond.i186 to i64
  %arrayidx46 = getelementptr [256 x i8], ptr %dav1d_sgr_x_by_x, i64 0, i64 %idxprom45
  %1 = load i8, ptr %arrayidx46, align 1
  %conv47 = zext i8 %1 to i32
  %mul51 = mul i32 0, %conv47
  store i32 %mul51, ptr %sumsq, align 4
  store i32 0, ptr null, align 4
  %indvars.iv.next = add i64 %indvars.iv1, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 0
  br i1 %exitcond.not, label %for.cond22.for.cond.cleanup26_crit_edge, label %for.body27
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #0

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
```

```
$ opt -passes="function<eager-inv>(loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>)" -disable-output /tmp/a.ll
opt: ../../llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7382: VectorizationFactor llvm::LoopVectorizationPlanner::computeBestVF(): Assertion `(BestFactor.Width == LegacyVF.Width || planContainsAdditionalSimplifications(getPlanFor(BestFactor.Width), CostCtx, OrigLoop)) && " VPlan cost model and legacy cost model disagreed"' failed.                                            
```

https://github.com/llvm/llvm-project/pull/106047


More information about the llvm-commits mailing list