Reid Spencer | 91948d4 | 2007-04-14 20:13:02 +0000 | [diff] [blame] | 1 | ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -globaldce | llvm-dis | \ |
| 2 | ; RUN: not grep Array |
Chris Lattner | 340ab5b | 2005-01-31 04:49:22 +0000 | [diff] [blame] | 3 | |
| 4 | ; Pulling the cast out of the load allows us to eliminate the load, and then |
| 5 | ; the whole array. |
| 6 | |
| 7 | %unop = type {int } |
| 8 | %op = type {float} |
| 9 | |
| 10 | %Array = internal constant [1 x %op* (%op*)*] [ %op* (%op*)* %foo ] |
| 11 | |
| 12 | implementation |
| 13 | |
| 14 | %op* %foo(%op* %X) { |
| 15 | ret %op* %X |
| 16 | } |
| 17 | |
| 18 | %unop* %caller(%op* %O) { |
| 19 | %tmp = load %unop* (%op*)** cast ([1 x %op* (%op*)*]* %Array to %unop* (%op*)**) |
| 20 | %tmp.2 = call %unop* (%op*)* %tmp(%op* %O) |
| 21 | ret %unop* %tmp.2 |
| 22 | } |
| 23 | |