llvm.org GIT mirror llvm / e04f865
new testcase for PR590 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22317 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 14 years ago
1 changed file(s) with 51 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: llvm-as < %s | opt -mem2reg -instcombine | llvm-dis | grep store
1 ; PR590
2
3 void %zero(sbyte* %p, int %n) {
4 entry:
5 %p_addr = alloca sbyte* ; [#uses=2]
6 %n_addr = alloca int ; [#uses=2]
7 %i = alloca int ; [#uses=6]
8 %out = alloca int ; [#uses=2]
9 %undef = alloca int ; [#uses=2]
10 store sbyte* %p, sbyte** %p_addr
11 store int %n, int* %n_addr
12 store int 0, int* %i
13 br label %loopentry
14
15 loopentry: ; preds = %endif, %entry
16 %tmp.0 = load int* %n_addr ; [#uses=1]
17 %tmp.1 = add int %tmp.0, 1 ; [#uses=1]
18 %tmp.2 = load int* %i ; [#uses=1]
19 %tmp.3 = setgt int %tmp.1, %tmp.2 ; [#uses=2]
20 %tmp.4 = cast bool %tmp.3 to int ; [#uses=0]
21 br bool %tmp.3, label %no_exit, label %return
22
23 no_exit: ; preds = %loopentry
24 %tmp.5 = load int* %undef ; [#uses=1]
25 store int %tmp.5, int* %out
26 store int 0, int* %undef
27 %tmp.6 = load int* %i ; [#uses=1]
28 %tmp.7 = setgt int %tmp.6, 0 ; [#uses=2]
29 %tmp.8 = cast bool %tmp.7 to int ; [#uses=0]
30 br bool %tmp.7, label %then, label %endif
31
32 then: ; preds = %no_exit
33 %tmp.9 = load sbyte** %p_addr ; [#uses=1]
34 %tmp.10 = load int* %i ; [#uses=1]
35 %tmp.11 = sub int %tmp.10, 1 ; [#uses=1]
36 %tmp.12 = getelementptr sbyte* %tmp.9, int %tmp.11 ; [#uses=1]
37 %tmp.13 = load int* %out ; [#uses=1]
38 %tmp.14 = cast int %tmp.13 to sbyte ; [#uses=1]
39 store sbyte %tmp.14, sbyte* %tmp.12
40 br label %endif
41
42 endif: ; preds = %then, %no_exit
43 %tmp.15 = load int* %i ; [#uses=1]
44 %inc = add int %tmp.15, 1 ; [#uses=1]
45 store int %inc, int* %i
46 br label %loopentry
47
48 return: ; preds = %loopentry
49 ret void
50 }