blob: 92f58e8b33fe51bce6f262b5882fdd582922b2f4 [file] [log] [blame]
Chris Lattner8673e442002-08-22 20:22:55 +00001; 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
14implementation
15
16int %test(bool %c) {
17 %Atmp = load int* %A
18 br label %Loop
19Loop:
20 %ToRemove = load int* %A
21 store int %ToRemove, int* %B ; Store cannot alias %A
22
23 br bool %c, label %Out, label %Loop
24Out:
25 ret int 7
26
27Dummy:
28 store int 7, int* %A
29 br label %Loop
30}
31