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. | ||||
Misha Brukman | e78760e | 2003-09-16 15:29:54 +0000 | [diff] [blame] | 3 | ; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | grep sub |
Chris Lattner | 5abaa0c | 2002-05-16 01:03:12 +0000 | [diff] [blame] | 4 | ; |
Chris Lattner | 14d7f5d | 2003-06-16 11:59:34 +0000 | [diff] [blame] | 5 | int %test1(int* %P) { |
Chris Lattner | 5abaa0c | 2002-05-16 01:03:12 +0000 | [diff] [blame] | 6 | %A = load int* %P |
Chris Lattner | 14d7f5d | 2003-06-16 11:59:34 +0000 | [diff] [blame] | 7 | store int 1, int* %P |
Chris Lattner | 5abaa0c | 2002-05-16 01:03:12 +0000 | [diff] [blame] | 8 | %B = load int* %P |
Chris Lattner | 14d7f5d | 2003-06-16 11:59:34 +0000 | [diff] [blame] | 9 | %C = sub int %A, %B |
Chris Lattner | 5abaa0c | 2002-05-16 01:03:12 +0000 | [diff] [blame] | 10 | ret int %C |
11 | } | ||||
12 | |||||
Chris Lattner | 14d7f5d | 2003-06-16 11:59:34 +0000 | [diff] [blame] | 13 | int %test2(int* %P) { |
Chris Lattner | 5abaa0c | 2002-05-16 01:03:12 +0000 | [diff] [blame] | 14 | %A = load int* %P |
15 | br label %BB2 | ||||
16 | BB2: | ||||
Chris Lattner | 14d7f5d | 2003-06-16 11:59:34 +0000 | [diff] [blame] | 17 | store int 5, int* %P |
Chris Lattner | 5abaa0c | 2002-05-16 01:03:12 +0000 | [diff] [blame] | 18 | br label %BB3 |
19 | BB3: | ||||
20 | %B = load int* %P | ||||
Chris Lattner | 14d7f5d | 2003-06-16 11:59:34 +0000 | [diff] [blame] | 21 | %C = sub int %A, %B |
Chris Lattner | 5abaa0c | 2002-05-16 01:03:12 +0000 | [diff] [blame] | 22 | ret int %C |
23 | } | ||||
24 | |||||
25 |