Benjamin Kramer | a42a757 | 2011-04-25 10:12:01 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=x86-64 -relocation-model=static -mtriple=x86_64-unknown-linux-gnu -asm-verbose=0 | FileCheck %s |
Dan Gohman | bbc1da8 | 2010-08-17 22:50:37 +0000 | [diff] [blame] | 2 | |
| 3 | ; The inner loop should require only one add (and no leas either). |
| 4 | ; rdar://8100380 |
| 5 | |
Benjamin Kramer | a42a757 | 2011-04-25 10:12:01 +0000 | [diff] [blame] | 6 | ; CHECK: BB0_3: |
Dan Gohman | bbc1da8 | 2010-08-17 22:50:37 +0000 | [diff] [blame] | 7 | ; CHECK-NEXT: movb $0, flags(%rdx) |
| 8 | ; CHECK-NEXT: addq %rcx, %rdx |
| 9 | ; CHECK-NEXT: cmpq $8192, %rdx |
| 10 | ; CHECK-NEXT: jl |
| 11 | |
| 12 | @flags = external global [8192 x i8], align 16 ; <[8192 x i8]*> [#uses=1] |
| 13 | |
| 14 | define void @foo() nounwind { |
| 15 | entry: |
| 16 | %tmp = icmp slt i64 2, 8192 ; <i1> [#uses=1] |
| 17 | br i1 %tmp, label %bb, label %bb21 |
| 18 | |
| 19 | bb: ; preds = %entry |
| 20 | br label %bb7 |
| 21 | |
| 22 | bb7: ; preds = %bb, %bb17 |
| 23 | %tmp8 = phi i64 [ %tmp18, %bb17 ], [ 2, %bb ] ; <i64> [#uses=2] |
| 24 | %tmp9 = icmp slt i64 2, 8192 ; <i1> [#uses=1] |
| 25 | br i1 %tmp9, label %bb10, label %bb17 |
| 26 | |
| 27 | bb10: ; preds = %bb7 |
| 28 | br label %bb11 |
| 29 | |
| 30 | bb11: ; preds = %bb10, %bb11 |
| 31 | %tmp12 = phi i64 [ %tmp14, %bb11 ], [ 2, %bb10 ] ; <i64> [#uses=2] |
| 32 | %tmp13 = getelementptr inbounds [8192 x i8]* @flags, i64 0, i64 %tmp12 ; <i8*> [#uses=1] |
| 33 | store i8 0, i8* %tmp13, align 1 |
| 34 | %tmp14 = add nsw i64 %tmp12, %tmp8 ; <i64> [#uses=2] |
| 35 | %tmp15 = icmp slt i64 %tmp14, 8192 ; <i1> [#uses=1] |
| 36 | br i1 %tmp15, label %bb11, label %bb16 |
| 37 | |
| 38 | bb16: ; preds = %bb11 |
| 39 | br label %bb17 |
| 40 | |
| 41 | bb17: ; preds = %bb16, %bb7 |
| 42 | %tmp18 = add nsw i64 %tmp8, 1 ; <i64> [#uses=2] |
| 43 | %tmp19 = icmp slt i64 %tmp18, 8192 ; <i1> [#uses=1] |
| 44 | br i1 %tmp19, label %bb7, label %bb20 |
| 45 | |
| 46 | bb20: ; preds = %bb17 |
| 47 | br label %bb21 |
| 48 | |
| 49 | bb21: ; preds = %bb20, %entry |
| 50 | ret void |
| 51 | } |