Oops, actually USE the previously computed value
[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 | grep -C1 getelementptr | grep Out:
7
8 %Ty = type { int, int }
9 %X = external global %Ty
10
11 int %test() {
12         br label %Loop
13 Loop:
14         %dead = getelementptr %Ty* %X, long 0, ubyte 0
15         %sunk2 = load int* %dead
16         br bool false, label %Loop, label %Out
17 Out:
18         ret int %sunk2
19 }