1 ; RUN: llc < %s -relocation-model=static -mtriple=x86_64-unknown-linux-gnu -asm-verbose=0 | FileCheck %s
3 ; The inner loop should require only one add (and no leas either).
7 ; CHECK-NEXT: movb $0, flags(%rcx)
8 ; CHECK-NEXT: addq %rax, %rcx
9 ; CHECK-NEXT: cmpq $8192, %rcx
12 @flags = external global [8192 x i8], align 16 ; <[8192 x i8]*> [#uses=1]
14 define void @foo() nounwind {
21 bb7: ; preds = %bb, %bb17
22 %tmp8 = phi i64 [ %tmp18, %bb17 ], [ 2, %bb ] ; <i64> [#uses=2]
28 bb11: ; preds = %bb10, %bb11
29 %tmp12 = phi i64 [ %tmp14, %bb11 ], [ 2, %bb10 ] ; <i64> [#uses=2]
30 %tmp13 = getelementptr inbounds [8192 x i8], [8192 x i8]* @flags, i64 0, i64 %tmp12 ; <i8*> [#uses=1]
31 store i8 0, i8* %tmp13, align 1
32 %tmp14 = add nsw i64 %tmp12, %tmp8 ; <i64> [#uses=2]
33 %tmp15 = icmp slt i64 %tmp14, 8192 ; <i1> [#uses=1]
34 br i1 %tmp15, label %bb11, label %bb16
39 bb17: ; preds = %bb16, %bb7
40 %tmp18 = add nsw i64 %tmp8, 1 ; <i64> [#uses=2]
41 %tmp19 = icmp slt i64 %tmp18, 8192 ; <i1> [#uses=1]
42 br i1 %tmp19, label %bb7, label %bb20
47 bb21: ; preds = %bb20, %entry