New testcase
[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 -load-vn -gcse | dis > Output/%s.after
5 ; RUN: echo some output
6 ; RUN: diff Output/%s.before Output/%s.after
7 ;
8 int "test1"(int* %P) {
9         %A = load int* %P
10         store int 1, int * %P
11         %B = load int* %P
12         %C = add int %A, %B
13         ret int %C
14 }
15
16 int "test2"(int* %P) {
17         %A = load int* %P
18         br label %BB2
19 BB2:
20         store int 5, int * %P
21         br label %BB3
22 BB3:
23         %B = load int* %P
24         %C = add int %A, %B
25         ret int %C
26 }
27
28