new testcase for PR1435
[oota-llvm.git] / test / Transforms / LICM / sink_load.ll
1 ; To reduce register pressure, if a load is hoistable out of the loop, and the
2 ; result of the load is only used outside of the loop, sink the load instead of
3 ; hoisting it!
4 ;
5 ; RUN: llvm-upgrade < %s | llvm-as | opt -licm | llvm-dis | %prcontext load 1 | grep Out: 
6
7 %X = global int 5
8
9 int %test(int %N) {
10 Entry:
11         br label %Loop
12 Loop:
13         %N_addr.0.pn = phi int [ %dec, %Loop ], [ %N, %Entry ]
14         %tmp.6 = load int* %X
15         %dec = add int %N_addr.0.pn, -1
16         %tmp.1 = setne int %N_addr.0.pn, 1
17         br bool %tmp.1, label %Loop, label %Out
18 Out:
19         ret int %tmp.6
20 }