Move a DenseMap's declaration outside of a loop, and just call
[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 define i32 @test(i32 %N) {
8 Entry:
9         br label %Loop
10 Loop:           ; preds = %Loop, %Entry
11         %N_addr.0.pn = phi i32 [ %dec, %Loop ], [ %N, %Entry ]          ; <i32> [#uses=3]
12         %tmp.6 = mul i32 %N, %N_addr.0.pn               ; <i32> [#uses=1]
13         %tmp.7 = sub i32 %tmp.6, %N             ; <i32> [#uses=1]
14         %dec = add i32 %N_addr.0.pn, -1         ; <i32> [#uses=1]
15         %tmp.1 = icmp ne i32 %N_addr.0.pn, 1            ; <i1> [#uses=1]
16         br i1 %tmp.1, label %Loop, label %Out
17 Out:            ; preds = %Loop
18         ret i32 %tmp.7
19 }
20