Chris Lattner | 8673e44 | 2002-08-22 20:22:55 +0000 | [diff] [blame^] | 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 | %Atmp = load int* %A |
| 18 | br label %Loop |
| 19 | Loop: |
| 20 | %ToRemove = load int* %A |
| 21 | store int %ToRemove, int* %B ; Store cannot alias %A |
| 22 | |
| 23 | br bool %c, label %Out, label %Loop |
| 24 | Out: |
| 25 | ret int 7 |
| 26 | |
| 27 | Dummy: |
| 28 | store int 7, int* %A |
| 29 | br label %Loop |
| 30 | } |
| 31 | |