2006-12-02 12:23:10 +08:00
|
|
|
; RUN: llvm-upgrade < %s | llvm-as | llvm-dis > %t1.ll
|
2004-11-07 14:08:43 +08:00
|
|
|
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
|
|
|
|
; RUN: diff %t1.ll %t2.ll
|
|
|
|
|
2001-10-13 15:05:07 +08:00
|
|
|
%FunTy = type int(int)
|
|
|
|
|
2007-01-08 03:33:49 +08:00
|
|
|
declare int "test"(int) ; Test forward declaration merging
|
2001-10-13 15:05:07 +08:00
|
|
|
|
2001-06-07 04:29:01 +08:00
|
|
|
implementation
|
|
|
|
|
2005-05-06 14:18:33 +08:00
|
|
|
void "invoke"(%FunTy *%x) {
|
2001-10-13 15:05:07 +08:00
|
|
|
%foo = call %FunTy* %x(int 123)
|
2005-05-06 14:18:33 +08:00
|
|
|
%foo2 = tail call %FunTy* %x(int 123)
|
2001-10-13 15:05:07 +08:00
|
|
|
ret void
|
2005-05-06 14:18:33 +08:00
|
|
|
}
|
2001-06-07 04:29:01 +08:00
|
|
|
|
|
|
|
int "main"(int %argc) ; TODO: , sbyte **argv, sbyte **envp)
|
|
|
|
begin
|
2001-10-03 22:50:12 +08:00
|
|
|
%retval = call int (int) *%test(int %argc)
|
2001-06-07 04:29:01 +08:00
|
|
|
%two = add int %retval, %retval
|
2001-10-13 15:05:07 +08:00
|
|
|
%retval2 = invoke int %test(int %argc)
|
|
|
|
to label %Next except label %Error
|
|
|
|
Next:
|
|
|
|
%two2 = add int %two, %retval2
|
|
|
|
call void %invoke (%FunTy* %test)
|
|
|
|
ret int %two2
|
|
|
|
Error:
|
|
|
|
ret int -1
|
2001-06-07 04:29:01 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
int "test"(int %i0)
|
|
|
|
begin
|
|
|
|
ret int %i0
|
|
|
|
end
|