1 ; RUN: llc < %s -march=x86 -stats |& grep {Number of reloads omited} | grep 1
2 ; RUN: llc < %s -march=x86 -stats |& grep {Number of available reloads turned into copies} | grep 1
3 ; RUN: llc < %s -march=x86 -stats |& grep {Number of machine instrs printed} | grep 40
5 ; The loop reversal kicks in once here, resulting in one fewer instruction.
7 target triple = "i386-pc-linux-gnu"
8 @x = external global [8 x i32], align 32 ; <[8 x i32]*> [#uses=1]
9 @rows = external global [8 x i32], align 32 ; <[8 x i32]*> [#uses=2]
10 @up = external global [15 x i32], align 32 ; <[15 x i32]*> [#uses=2]
11 @down = external global [15 x i32], align 32 ; <[15 x i32]*> [#uses=1]
13 define i32 @queens(i32 %c) nounwind {
15 %tmp91 = add i32 %c, 1 ; <i32> [#uses=3]
16 %tmp135 = getelementptr [8 x i32]* @x, i32 0, i32 %tmp91 ; <i32*> [#uses=1]
19 bb: ; preds = %bb569, %entry
20 %r25.0.reg2mem.0 = phi i32 [ 0, %entry ], [ %indvar.next715, %bb569 ] ; <i32> [#uses=4]
21 %tmp27 = getelementptr [8 x i32]* @rows, i32 0, i32 %r25.0.reg2mem.0 ; <i32*> [#uses=1]
22 %tmp28 = load i32* %tmp27, align 4 ; <i32> [#uses=1]
23 %tmp29 = icmp eq i32 %tmp28, 0 ; <i1> [#uses=1]
24 br i1 %tmp29, label %bb569, label %bb31
27 %tmp35 = sub i32 %r25.0.reg2mem.0, 0 ; <i32> [#uses=1]
28 %tmp36 = getelementptr [15 x i32]* @up, i32 0, i32 %tmp35 ; <i32*> [#uses=1]
29 %tmp37 = load i32* %tmp36, align 4 ; <i32> [#uses=1]
30 %tmp38 = icmp eq i32 %tmp37, 0 ; <i1> [#uses=1]
31 br i1 %tmp38, label %bb569, label %bb41
34 %tmp54 = sub i32 %r25.0.reg2mem.0, %c ; <i32> [#uses=1]
35 %tmp55 = add i32 %tmp54, 7 ; <i32> [#uses=1]
36 %tmp62 = getelementptr [15 x i32]* @up, i32 0, i32 %tmp55 ; <i32*> [#uses=2]
37 store i32 0, i32* %tmp62, align 4
40 bb92: ; preds = %bb545, %bb41
41 %r20.0.reg2mem.0 = phi i32 [ 0, %bb41 ], [ %indvar.next711, %bb545 ] ; <i32> [#uses=5]
42 %tmp94 = getelementptr [8 x i32]* @rows, i32 0, i32 %r20.0.reg2mem.0 ; <i32*> [#uses=1]
43 %tmp95 = load i32* %tmp94, align 4 ; <i32> [#uses=0]
44 %tmp112 = add i32 %r20.0.reg2mem.0, %tmp91 ; <i32> [#uses=1]
45 %tmp113 = getelementptr [15 x i32]* @down, i32 0, i32 %tmp112 ; <i32*> [#uses=2]
46 %tmp114 = load i32* %tmp113, align 4 ; <i32> [#uses=1]
47 %tmp115 = icmp eq i32 %tmp114, 0 ; <i1> [#uses=1]
48 br i1 %tmp115, label %bb545, label %bb118
50 bb118: ; preds = %bb92
51 %tmp122 = sub i32 %r20.0.reg2mem.0, %tmp91 ; <i32> [#uses=0]
52 store i32 0, i32* %tmp113, align 4
53 store i32 %r20.0.reg2mem.0, i32* %tmp135, align 4
56 bb142: ; preds = %bb142, %bb118
57 %k18.0.reg2mem.0 = phi i32 [ 0, %bb118 ], [ %indvar.next709, %bb142 ] ; <i32> [#uses=1]
58 %indvar.next709 = add i32 %k18.0.reg2mem.0, 1 ; <i32> [#uses=2]
59 %exitcond710 = icmp eq i32 %indvar.next709, 8 ; <i1> [#uses=1]
60 br i1 %exitcond710, label %bb155, label %bb142
62 bb155: ; preds = %bb142
63 %tmp156 = tail call i32 @putchar(i32 10) nounwind ; <i32> [#uses=0]
66 bb545: ; preds = %bb155, %bb92
67 %indvar.next711 = add i32 %r20.0.reg2mem.0, 1 ; <i32> [#uses=2]
68 %exitcond712 = icmp eq i32 %indvar.next711, 8 ; <i1> [#uses=1]
69 br i1 %exitcond712, label %bb553, label %bb92
71 bb553: ; preds = %bb545
72 store i32 1, i32* %tmp62, align 4
75 bb569: ; preds = %bb553, %bb31, %bb
76 %indvar.next715 = add i32 %r25.0.reg2mem.0, 1 ; <i32> [#uses=1]
80 declare i32 @putchar(i32)