Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame^] | 1 | ; This testcase ensures that redundant loads are preserved when they are not |
2 | ; allowed to be eliminated. | ||||
3 | ; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse | llvm-dis | grep sub | ||||
4 | ; | ||||
5 | int %test1(int* %P) { | ||||
6 | %A = load int* %P | ||||
7 | store int 1, int* %P | ||||
8 | %B = load int* %P | ||||
9 | %C = sub int %A, %B | ||||
10 | ret int %C | ||||
11 | } | ||||
12 | |||||
13 | int %test2(int* %P) { | ||||
14 | %A = load int* %P | ||||
15 | br label %BB2 | ||||
16 | BB2: | ||||
17 | store int 5, int* %P | ||||
18 | br label %BB3 | ||||
19 | BB3: | ||||
20 | %B = load int* %P | ||||
21 | %C = sub int %A, %B | ||||
22 | ret int %C | ||||
23 | } | ||||
24 | |||||
25 |