blob: f015223c5d75acc528b219579303be9b92bad1bb [file] [log] [blame]
Reid Spencerd0e30dc2006-12-02 04:23:10 +00001; RUN: llvm-upgrade < %s | llvm-as | llvm-dis > %t1.ll
Tanya Lattner84f7fda2004-11-07 06:08:43 +00002; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
3; RUN: diff %t1.ll %t2.ll
4
Chris Lattnerdcd96762001-10-13 07:05:07 +00005%FunTy = type int(int)
6
Reid Spencer968a5292007-01-07 19:33:49 +00007declare int "test"(int) ; Test forward declaration merging
Chris Lattnerdcd96762001-10-13 07:05:07 +00008
Chris Lattner2f7c9632001-06-06 20:29:01 +00009implementation
10
Chris Lattner2c9a46e2005-05-06 06:18:33 +000011void "invoke"(%FunTy *%x) {
Chris Lattnerdcd96762001-10-13 07:05:07 +000012 %foo = call %FunTy* %x(int 123)
Chris Lattner2c9a46e2005-05-06 06:18:33 +000013 %foo2 = tail call %FunTy* %x(int 123)
Chris Lattnerdcd96762001-10-13 07:05:07 +000014 ret void
Chris Lattner2c9a46e2005-05-06 06:18:33 +000015}
Chris Lattner2f7c9632001-06-06 20:29:01 +000016
17int "main"(int %argc) ; TODO: , sbyte **argv, sbyte **envp)
18begin
Chris Lattner23356652001-10-03 14:50:12 +000019 %retval = call int (int) *%test(int %argc)
Chris Lattner2f7c9632001-06-06 20:29:01 +000020 %two = add int %retval, %retval
Chris Lattnerdcd96762001-10-13 07:05:07 +000021 %retval2 = invoke int %test(int %argc)
22 to label %Next except label %Error
23Next:
24 %two2 = add int %two, %retval2
25 call void %invoke (%FunTy* %test)
26 ret int %two2
27Error:
28 ret int -1
Chris Lattner2f7c9632001-06-06 20:29:01 +000029end
30
31int "test"(int %i0)
32begin
33 ret int %i0
34end