Use the llvm-upgrade program to upgrade llvm assembly.
[oota-llvm.git] / test / Transforms / LICM / 2003-05-02-LoadHoist.ll
1 ; This testcase tests for a problem where LICM hoists loads out of a loop 
2 ; despite the fact that calls to unknown functions may modify what is being 
3 ; loaded from.  Basically if the load gets hoisted, the subtract gets turned
4 ; into a constant zero.
5 ;
6 ; RUN: llvm-upgrade < %s | llvm-as | opt -licm -load-vn -gcse -instcombine | llvm-dis | grep load
7
8 %X = global int 7
9 declare void %foo()
10
11 int %test(bool %c) {
12         %A = load int *%X
13         br label %Loop
14 Loop:
15         call void %foo()
16         %B = load int *%X  ;; Should not hoist this load!
17         br bool %c, label %Loop, label %Out
18 Out:
19         %C = sub int %A, %B
20         ret int %C
21 }