Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -march=x86 -stats -regalloc=linearscan -enable-lsr-nested |& grep {Number of loads added} | grep 2
      2 ; RUN: llc < %s -march=x86 -stats -regalloc=linearscan -enable-lsr-nested |& grep {Number of spill slots allocated} | grep 1
      3 ; RUN: llc < %s -march=x86 -stats -regalloc=linearscan -enable-lsr-nested |& grep {Number of machine instrs printed} | grep 34
      4 ; PR3495
      5 ;
      6 ; Note: this should not spill at all with either good LSR or good regalloc.
      7 
      8 target triple = "i386-pc-linux-gnu"
      9 @x = external global [8 x i32], align 32		; <[8 x i32]*> [#uses=1]
     10 @rows = external global [8 x i32], align 32		; <[8 x i32]*> [#uses=2]
     11 @up = external global [15 x i32], align 32		; <[15 x i32]*> [#uses=2]
     12 @down = external global [15 x i32], align 32		; <[15 x i32]*> [#uses=1]
     13 
     14 define i32 @queens(i32 %c) nounwind {
     15 entry:
     16 	%tmp91 = add i32 %c, 1		; <i32> [#uses=3]
     17 	%tmp135 = getelementptr [8 x i32]* @x, i32 0, i32 %tmp91		; <i32*> [#uses=1]
     18 	br label %bb
     19 
     20 bb:		; preds = %bb569, %entry
     21 	%r25.0.reg2mem.0 = phi i32 [ 0, %entry ], [ %indvar.next715, %bb569 ]		; <i32> [#uses=4]
     22 	%tmp27 = getelementptr [8 x i32]* @rows, i32 0, i32 %r25.0.reg2mem.0		; <i32*> [#uses=1]
     23 	%tmp28 = load i32* %tmp27, align 4		; <i32> [#uses=1]
     24 	%tmp29 = icmp eq i32 %tmp28, 0		; <i1> [#uses=1]
     25 	br i1 %tmp29, label %bb569, label %bb31
     26 
     27 bb31:		; preds = %bb
     28 	%tmp35 = sub i32 %r25.0.reg2mem.0, 0		; <i32> [#uses=1]
     29 	%tmp36 = getelementptr [15 x i32]* @up, i32 0, i32 %tmp35		; <i32*> [#uses=1]
     30 	%tmp37 = load i32* %tmp36, align 4		; <i32> [#uses=1]
     31 	%tmp38 = icmp eq i32 %tmp37, 0		; <i1> [#uses=1]
     32 	br i1 %tmp38, label %bb569, label %bb41
     33 
     34 bb41:		; preds = %bb31
     35 	%tmp54 = sub i32 %r25.0.reg2mem.0, %c		; <i32> [#uses=1]
     36 	%tmp55 = add i32 %tmp54, 7		; <i32> [#uses=1]
     37 	%tmp62 = getelementptr [15 x i32]* @up, i32 0, i32 %tmp55		; <i32*> [#uses=2]
     38 	store i32 0, i32* %tmp62, align 4
     39 	br label %bb92
     40 
     41 bb92:		; preds = %bb545, %bb41
     42 	%r20.0.reg2mem.0 = phi i32 [ 0, %bb41 ], [ %indvar.next711, %bb545 ]		; <i32> [#uses=5]
     43 	%tmp94 = getelementptr [8 x i32]* @rows, i32 0, i32 %r20.0.reg2mem.0		; <i32*> [#uses=1]
     44 	%tmp95 = load i32* %tmp94, align 4		; <i32> [#uses=0]
     45 	%tmp112 = add i32 %r20.0.reg2mem.0, %tmp91		; <i32> [#uses=1]
     46 	%tmp113 = getelementptr [15 x i32]* @down, i32 0, i32 %tmp112		; <i32*> [#uses=2]
     47 	%tmp114 = load i32* %tmp113, align 4		; <i32> [#uses=1]
     48 	%tmp115 = icmp eq i32 %tmp114, 0		; <i1> [#uses=1]
     49 	br i1 %tmp115, label %bb545, label %bb118
     50 
     51 bb118:		; preds = %bb92
     52 	%tmp122 = sub i32 %r20.0.reg2mem.0, %tmp91		; <i32> [#uses=0]
     53 	store i32 0, i32* %tmp113, align 4
     54 	store i32 %r20.0.reg2mem.0, i32* %tmp135, align 4
     55 	br label %bb142
     56 
     57 bb142:		; preds = %bb142, %bb118
     58 	%k18.0.reg2mem.0 = phi i32 [ 0, %bb118 ], [ %indvar.next709, %bb142 ]		; <i32> [#uses=1]
     59 	%indvar.next709 = add i32 %k18.0.reg2mem.0, 1		; <i32> [#uses=2]
     60 	%exitcond710 = icmp eq i32 %indvar.next709, 8		; <i1> [#uses=1]
     61 	br i1 %exitcond710, label %bb155, label %bb142
     62 
     63 bb155:		; preds = %bb142
     64 	%tmp156 = tail call i32 @putchar(i32 10) nounwind		; <i32> [#uses=0]
     65 	br label %bb545
     66 
     67 bb545:		; preds = %bb155, %bb92
     68 	%indvar.next711 = add i32 %r20.0.reg2mem.0, 1		; <i32> [#uses=2]
     69 	%exitcond712 = icmp eq i32 %indvar.next711, 8		; <i1> [#uses=1]
     70 	br i1 %exitcond712, label %bb553, label %bb92
     71 
     72 bb553:		; preds = %bb545
     73 	store i32 1, i32* %tmp62, align 4
     74 	br label %bb569
     75 
     76 bb569:		; preds = %bb553, %bb31, %bb
     77 	%indvar.next715 = add i32 %r25.0.reg2mem.0, 1		; <i32> [#uses=1]
     78 	br label %bb
     79 }
     80 
     81 declare i32 @putchar(i32)
     82