Fix PR2346 by marking vaarg as volatile so that licm doesn't try to
[oota-llvm.git] / test / Transforms / LICM / sink_multiple.ll
1 ; The loop sinker was running from the bottom of the loop to the top, causing
2 ; it to miss opportunities to sink instructions that depended on sinking other
3 ; instructions from the loop.  Instead they got hoisted, which is better than
4 ; leaving them in the loop, but increases register pressure pointlessly.
5
6 ; RUN: llvm-as < %s | opt -licm | llvm-dis | \
7 ; RUN:    %prcontext getelementptr 1 | grep Out:
8
9         %Ty = type { i32, i32 }
10 @X = external global %Ty                ; <%Ty*> [#uses=1]
11
12 define i32 @test() {
13         br label %Loop
14 Loop:           ; preds = %Loop, %0
15         %dead = getelementptr %Ty* @X, i64 0, i32 0             ; <i32*> [#uses=1]
16         %sunk2 = load i32* %dead                ; <i32> [#uses=1]
17         br i1 false, label %Loop, label %Out
18 Out:            ; preds = %Loop
19         ret i32 %sunk2
20 }
21