[llvm] [VPlan] Don't use the legacy cost model for loop conditions (PR #156864)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 11 05:06:24 PST 2026
fhahn wrote:
Looks like there's another potential crash:
```
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "arm64-apple-macosx13.0.0"
define i32 @test(i32 %0, i64 %1, ptr %2) {
entry:
%shr13.i = lshr i32 32, %0
br label %for.cond27.preheader.us.i
for.cond27.preheader.us.i: ; preds = %for.body31.us36.i, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ 1, %for.body31.us36.i ]
br label %for.body31.us36.i
for.body31.us36.i:
%indvars.iv71.i = phi i64 [ %indvars.iv, %for.cond27.preheader.us.i ], [ %indvars.iv.next72.i, %for.body31.us36.i ]
%3 = getelementptr i32, ptr %2, i64 %indvars.iv71.i
%arrayidx44.us43.i = getelementptr i32, ptr %3, i64 %1
%4 = load i32, ptr %arrayidx44.us43.i, align 4
store i32 %4, ptr %3, align 4
store i16 0, ptr %2, align 2
%indvars.iv.next72.i = add i64 %indvars.iv71.i, 1
%5 = call i32 @llvm.umax.i32(i32 %shr13.i, i32 1)
%umax = zext i32 %5 to i64
%indvars.iv.next = add i64 %indvars.iv, %umax
%6 = and i64 %indvars.iv.next72.i, 4294967295
%exitcond.not.i146 = icmp eq i64 %indvars.iv.next, %6
br i1 %exitcond.not.i146, label %for.cond27.preheader.us.i, label %for.body31.us36.i
}
; Function Attrs: nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #0
attributes #0 = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) }
```
https://github.com/llvm/llvm-project/pull/156864
More information about the llvm-commits
mailing list