Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 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: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse | llvm-dis | not grep %RL | ||||
5 | ; | ||||
6 | int "test1"(int* %P) { | ||||
7 | %A = load int* %P | ||||
8 | %RL = load int* %P | ||||
9 | %C = add int %A, %RL | ||||
10 | ret int %C | ||||
11 | } | ||||
12 | |||||
13 | int "test2"(int* %P) { | ||||
14 | %A = load int* %P | ||||
15 | br label %BB2 | ||||
16 | BB2: | ||||
17 | br label %BB3 | ||||
18 | BB3: | ||||
19 | %RL = load int* %P | ||||
20 | %B = add int %A, %RL | ||||
21 | ret int %B | ||||
22 | } | ||||
23 |