Chris Lattner | 8c4b0d0 | 2003-06-26 05:05:51 +0000 | [diff] [blame^] | 1 | ; This test makes sure that these instructions are properly eliminated. |
| 2 | ; |
| 3 | |
| 4 | ; RUN: if as < %s | opt -instcombine | dis | grep load |
| 5 | ; RUN: then exit 1 |
| 6 | ; RUN: else exit 0 |
| 7 | ; RUN: fi |
| 8 | |
| 9 | %X = constant int 42 |
| 10 | %Y = constant [2 x { int, float }] [ { int, float } { int 12, float 1.0 }, |
| 11 | { int, float } { int 37, float 1.2312 } ] |
| 12 | int %test1() { |
| 13 | %B = load int* %X |
| 14 | ret int %B |
| 15 | } |
| 16 | |
| 17 | float %test2() { |
| 18 | %A = getelementptr [2 x { int, float}]* %Y, long 0, long 1, ubyte 1 |
| 19 | %B = load float* %A |
| 20 | ret float %B |
| 21 | } |
| 22 | |
| 23 | int %test3() { |
| 24 | %A = getelementptr [2 x { int, float}]* %Y, long 0, long 0, ubyte 0 |
| 25 | %B = load int* %A |
| 26 | ret int %B |
| 27 | } |
| 28 | |
| 29 | |