Chris Lattner | 5abaa0c | 2002-05-16 01:03:12 +0000 | [diff] [blame] | 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 |
Chris Lattner | 1a24282 | 2002-08-30 20:18:09 +0000 | [diff] [blame^] | 4 | ; RUN: as < %s | opt -load-vn -gcse | dis > Output/%s.after |
| 5 | ; RUN: echo some output |
Chris Lattner | 5abaa0c | 2002-05-16 01:03:12 +0000 | [diff] [blame] | 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 | |