blob: feafd3cd208486f8616c49375545c91bc37d32ad [file] [log] [blame]
Tanya Lattner9bc243b2008-03-01 07:38:40 +00001; RUN: llvm-as < %s | llvm-dis > %t1.ll
Tanya Lattner3f7706b2004-11-07 06:08:43 +00002; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
3; RUN: diff %t1.ll %t2.ll
4
Tanya Lattner9bc243b2008-03-01 07:38:40 +00005%FunTy = type i32 (i32)
Chris Lattner49ca7aa2001-10-13 07:05:07 +00006
Tanya Lattner9bc243b2008-03-01 07:38:40 +00007declare i32 @test(i32) ; Test forward declaration merging
Chris Lattner49ca7aa2001-10-13 07:05:07 +00008
Tanya Lattner9bc243b2008-03-01 07:38:40 +00009define void @invoke(%FunTy* %x) {
10 %foo = call i32 %x( i32 123 ) ; <i32> [#uses=0]
11 %foo2 = tail call i32 %x( i32 123 ) ; <i32> [#uses=0]
12 ret void
Chris Lattnerd100d4c2005-05-06 06:18:33 +000013}
Chris Lattner00950542001-06-06 20:29:01 +000014
Tanya Lattner9bc243b2008-03-01 07:38:40 +000015define i32 @main(i32 %argc) {
16 %retval = call i32 @test( i32 %argc ) ; <i32> [#uses=2]
17 %two = add i32 %retval, %retval ; <i32> [#uses=1]
18 %retval2 = invoke i32 @test( i32 %argc )
19 to label %Next unwind label %Error ; <i32> [#uses=1]
Chris Lattner00950542001-06-06 20:29:01 +000020
Tanya Lattner9bc243b2008-03-01 07:38:40 +000021Next: ; preds = %0
22 %two2 = add i32 %two, %retval2 ; <i32> [#uses=1]
23 call void @invoke( %FunTy* @test )
24 ret i32 %two2
25
26Error: ; preds = %0
27 ret i32 -1
28}
29
30define i32 @test(i32 %i0) {
31 ret i32 %i0
32}