1 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
2 ; RUN: grep call | notcast
6 ; Simple case, argument translatable without changing the value
7 declare void @test1a(i8*)
9 define void @test1(i32* %A) {
10 call void bitcast (void (i8*)* @test1a to void (i32*)*)( i32* %A )
14 ; More complex case, translate argument because of resolution. This is safe
15 ; because we have the body of the function
16 define void @test2a(i8 %A) {
20 define i32 @test2(i32 %A) {
21 call void bitcast (void (i8)* @test2a to void (i32)*)( i32 %A )
26 ; Resolving this should insert a cast from sbyte to int, following the C
28 declare void @test3a(i8, ...)
30 define void @test3(i8 %A, i8 %B) {
31 call void bitcast (void (i8, ...)* @test3a to void (i8, i8)*)( i8 %A, i8 %B
37 ; test conversion of return value...
43 %X = call i32 bitcast (i8 ()* @test4a to i32 ()*)( ) ; <i32> [#uses=1]
48 ; test conversion of return value... no value conversion occurs so we can do
49 ; this with just a prototype...
53 %X = call i32 @test5a( ) ; <i32> [#uses=1]
58 ; test addition of new arguments...
59 declare i32 @test6a(i32)
62 %X = call i32 bitcast (i32 (i32)* @test6a to i32 ()*)( ) ; <i32> [#uses=1]
67 ; test removal of arguments, only can happen with a function body
68 define void @test7a() {
72 define void @test7() {
73 call void bitcast (void ()* @test7a to void (i32)*)( i32 5 )