1; RUN: llc < %s | FileCheck %s
2; This test really wants to check that the resultant "cond_true" block only
3; has a single store in it, and that cond_true55 only has code to materialize
4; the constant and do a store.  We do *not* want something like this:
5;
6;LBB1_3: @cond_true
7;        add r8, r0, r6
8;        str r10, [r8, #+4]
9;
10; CHECK: ldr [[R6:r[0-9*]+]], LCP
11; CHECK: cmp {{.*}}, [[R6]]
12; CHECK: ldrle
13; CHECK-NEXT: strle
14
15target triple = "arm-apple-darwin8"
16
17define void @foo(i32* %mc, i32* %mpp, i32* %ip, i32* %dpp, i32* %tpmm, i32 %M, i32* %tpim, i32* %tpdm, i32* %bp, i32* %ms, i32 %xmb) {
18entry:
19	%tmp6584 = icmp slt i32 %M, 1		; <i1> [#uses=1]
20	br i1 %tmp6584, label %return, label %bb
21
22bb:		; preds = %cond_next59, %entry
23	%indvar = phi i32 [ 0, %entry ], [ %k.069.0, %cond_next59 ]		; <i32> [#uses=6]
24	%k.069.0 = add i32 %indvar, 1		; <i32> [#uses=3]
25	%tmp3 = getelementptr i32* %mpp, i32 %indvar		; <i32*> [#uses=1]
26	%tmp4 = load i32* %tmp3		; <i32> [#uses=1]
27	%tmp8 = getelementptr i32* %tpmm, i32 %indvar		; <i32*> [#uses=1]
28	%tmp9 = load i32* %tmp8		; <i32> [#uses=1]
29	%tmp10 = add i32 %tmp9, %tmp4		; <i32> [#uses=2]
30	%tmp13 = getelementptr i32* %mc, i32 %k.069.0		; <i32*> [#uses=5]
31	store i32 %tmp10, i32* %tmp13
32	%tmp17 = getelementptr i32* %ip, i32 %indvar		; <i32*> [#uses=1]
33	%tmp18 = load i32* %tmp17		; <i32> [#uses=1]
34	%tmp22 = getelementptr i32* %tpim, i32 %indvar		; <i32*> [#uses=1]
35	%tmp23 = load i32* %tmp22		; <i32> [#uses=1]
36	%tmp24 = add i32 %tmp23, %tmp18		; <i32> [#uses=2]
37	%tmp30 = icmp sgt i32 %tmp24, %tmp10		; <i1> [#uses=1]
38	br i1 %tmp30, label %cond_true, label %cond_next
39
40cond_true:		; preds = %bb
41	store i32 %tmp24, i32* %tmp13
42	br label %cond_next
43
44cond_next:		; preds = %cond_true, %bb
45	%tmp39 = load i32* %tmp13		; <i32> [#uses=1]
46	%tmp42 = getelementptr i32* %ms, i32 %k.069.0		; <i32*> [#uses=1]
47	%tmp43 = load i32* %tmp42		; <i32> [#uses=1]
48	%tmp44 = add i32 %tmp43, %tmp39		; <i32> [#uses=2]
49	store i32 %tmp44, i32* %tmp13
50	%tmp52 = icmp slt i32 %tmp44, -987654321		; <i1> [#uses=1]
51	br i1 %tmp52, label %cond_true55, label %cond_next59
52
53cond_true55:		; preds = %cond_next
54	store i32 -987654321, i32* %tmp13
55	br label %cond_next59
56
57cond_next59:		; preds = %cond_true55, %cond_next
58	%tmp61 = add i32 %indvar, 2		; <i32> [#uses=1]
59	%tmp65 = icmp sgt i32 %tmp61, %M		; <i1> [#uses=1]
60	br i1 %tmp65, label %return, label %bb
61
62return:		; preds = %cond_next59, %entry
63	ret void
64}
65