Tweak testcase
[oota-llvm.git] / test / Transforms / BasicAA / licmtest.ll
1 ; Test that LICM uses basicaa to do alias analysis, which is capable of 
2 ; disambiguating some obvious cases.  The ToRemove load should be eliminated
3 ; in this testcase.  This testcase was carefully contrived so that GCSE would
4 ; not be able to eliminate the load itself, without licm's help.  This is 
5 ; because, for GCSE, the load is killed by the dummy basic block.
6
7 ; RUN: if as < %s | opt -basicaa -licm -gcse -simplifycfg -instcombine | dis | grep ToRemove
8 ; RUN: then exit 1
9 ; RUN: else exit 0
10 ; RUN: fi
11
12 %A = global int 7
13 %B = global int 8
14 implementation
15
16 int %test(bool %c) {
17         %ToRemove = load int* %A
18         br label %Loop
19 Loop:
20         %Atmp = load int* %A
21         store int %Atmp, int* %B  ; Store cannot alias %A
22
23         br bool %c, label %Out, label %Loop
24 Out:
25         %X = sub int %ToRemove, %Atmp
26         ret int %X
27
28 Dummy:
29         store int 7, int* %A
30         br label %Loop
31 }
32