Add tests of redundant load elimination
[oota-llvm.git] / test / Analysis / LoadVN / RLE-Eliminate.ll
1 ; This testcase ensures that redundant loads are eliminated when they should 
2 ; be.  All RL variables (redundant loads) should be eliminated.
3 ;
4 ; RUN: if as < %s | opt -gcse | dis | grep %RL
5 ; RUN: then exit 1
6 ; RUN: else exit 0
7 ; RUN: fi
8 ;
9 int "test1"(int* %P) {
10         %A = load int* %P
11         %RL = load int* %P
12         %C = add int %A, %RL
13         ret int %C
14 }
15
16 int "test2"(int* %P) {
17         %A = load int* %P
18         br label %BB2
19 BB2:
20         br label %BB3
21 BB3:
22         %RL = load int* %P
23         %B = add int %A, %RL
24         ret int %B
25 }
26