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