Add tests of redundant load elimination
[oota-llvm.git] / test / Analysis / LoadVN / RLE-Preserve.ll
1 ; This testcase ensures that redundant loads are preserved when they are not 
2 ; allowed to be eliminated.
3 ; RUN: as < %s | dis > Output/%s.before
4 ; RUN: as < %s | opt -gcse | dis > Output/%s.after
5 ; RUN: diff Output/%s.before Output/%s.after
6 ;
7 int "test1"(int* %P) {
8         %A = load int* %P
9         store int 1, int * %P
10         %B = load int* %P
11         %C = add int %A, %B
12         ret int %C
13 }
14
15 int "test2"(int* %P) {
16         %A = load int* %P
17         br label %BB2
18 BB2:
19         store int 5, int * %P
20         br label %BB3
21 BB3:
22         %B = load int* %P
23         %C = add int %A, %B
24         ret int %C
25 }
26
27