new testcase
[oota-llvm.git] / test / Transforms / LICM / sink_inst.ll
1 ; If the result of an instruction is only used outside of the loop, sink
2 ; the instruction to the exit blocks instead of executing it on every
3 ; iteration of the loop.
4 ;
5 ; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext mul 1 | grep Out: 
6
7 int %test(int %N) {
8 Entry:
9         br label %Loop
10 Loop:
11         %N_addr.0.pn = phi int [ %dec, %Loop ], [ %N, %Entry ]
12         %tmp.6 = mul int %N, %N_addr.0.pn
13         %tmp.7 = sub int %tmp.6, %N
14         %dec = add int %N_addr.0.pn, -1
15         %tmp.1 = setne int %N_addr.0.pn, 1
16         br bool %tmp.1, label %Loop, label %Out
17 Out:
18         ret int %tmp.7
19 }