blob: a7a325cdd9c1b9dc1cb9ca01762dda20f9caae21 [file] [log] [blame]
Chris Lattner2f7bb1b2004-09-19 18:45:45 +00001; Test promotion of loads that use the result of a select instruction. This
2; should be simplified by the instcombine pass.
Chris Lattner3b613812004-04-08 19:59:22 +00003
Reid Spencerd0e30dc2006-12-02 04:23:10 +00004; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -mem2reg | llvm-dis | not grep alloca
Chris Lattner3b613812004-04-08 19:59:22 +00005
6int %main() {
7 %mem_tmp.0 = alloca int ; <int*> [#uses=3]
8 %mem_tmp.1 = alloca int ; <int*> [#uses=3]
9 store int 0, int* %mem_tmp.0
10 store int 1, int* %mem_tmp.1
11 %tmp.1.i = load int* %mem_tmp.1 ; <int> [#uses=1]
12 %tmp.3.i = load int* %mem_tmp.0 ; <int> [#uses=1]
13 %tmp.4.i = setle int %tmp.1.i, %tmp.3.i ; <bool> [#uses=1]
14 %mem_tmp.i.0 = select bool %tmp.4.i, int* %mem_tmp.1, int* %mem_tmp.0 ; <int*> [#uses=1]
15 %tmp.3 = load int* %mem_tmp.i.0 ; <int> [#uses=1]
16 ret int %tmp.3
17}
18