1 ; RUN: opt < %s -passes='print<loop-cache-cost>' -disable-output 2>&1 | FileCheck %s
3 ; For a loop with a very large iteration count, make sure the cost
4 ; calculation does not overflow:
8 ; for (long d = 0; d < -3ULL; d += 2ULL)
12 ; CHECK: Loop 'outer.loop' has cost = 9223372036854775807
13 ; CHECK: Loop 'inner.loop' has cost = 9223372036854775807
15 @A = local_unnamed_addr global [11 x [11 x [11 x i32]]] zeroinitializer, align 16
17 define void @foo(i32 noundef %b) {
19 %0 = sext i32 %b to i64
23 %indvars.iv = phi i64 [ %indvars.iv.next, %outer.loop.cleanup ], [ 0, %entry ]
27 %indvars.iv.next = add nsw i64 %indvars.iv, %0
31 %inner.iv = phi i64 [ 0, %outer.loop ], [ %add, %inner.loop ]
32 %arrayidx3 = getelementptr inbounds [11 x [11 x [11 x i32]]], ptr @A, i64 0, i64 %indvars.iv, i64 %inner.iv, i64 %inner.iv
33 store i32 0, ptr %arrayidx3, align 4
34 %add = add nuw i64 %inner.iv, 2
35 %cmp = icmp ult i64 %inner.iv, -5
36 br i1 %cmp, label %inner.loop, label %outer.loop.cleanup