Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame^] | 1 | ; RUN: llvm-upgrade < %s | llvm-as | llvm-dis > %t1.ll |
| 2 | ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll |
| 3 | ; RUN: diff %t1.ll %t2.ll |
| 4 | |
| 5 | %FunTy = type int(int) |
| 6 | |
| 7 | declare int "test"(int) ; Test forward declaration merging |
| 8 | |
| 9 | implementation |
| 10 | |
| 11 | void "invoke"(%FunTy *%x) { |
| 12 | %foo = call %FunTy* %x(int 123) |
| 13 | %foo2 = tail call %FunTy* %x(int 123) |
| 14 | ret void |
| 15 | } |
| 16 | |
| 17 | int "main"(int %argc) ; TODO: , sbyte **argv, sbyte **envp) |
| 18 | begin |
| 19 | %retval = call int (int) *%test(int %argc) |
| 20 | %two = add int %retval, %retval |
| 21 | %retval2 = invoke int %test(int %argc) |
| 22 | to label %Next except label %Error |
| 23 | Next: |
| 24 | %two2 = add int %two, %retval2 |
| 25 | call void %invoke (%FunTy* %test) |
| 26 | ret int %two2 |
| 27 | Error: |
| 28 | ret int -1 |
| 29 | end |
| 30 | |
| 31 | int "test"(int %i0) |
| 32 | begin |
| 33 | ret int %i0 |
| 34 | end |