1 ; Ignore stderr, we expect warnings there
2 ; RUN: opt < %s -instcombine 2> /dev/null -S | \
3 ; RUN: grep call | notcast
7 ; Simple case, argument translatable without changing the value
8 declare void @test1a(i8*)
10 define void @test1(i32* %A) {
11 call void bitcast (void (i8*)* @test1a to void (i32*)*)( i32* %A )
15 ; More complex case, translate argument because of resolution. This is safe
16 ; because we have the body of the function
17 define void @test2a(i8 %A) {
21 define i32 @test2(i32 %A) {
22 call void bitcast (void (i8)* @test2a to void (i32)*)( i32 %A )
27 ; Resolving this should insert a cast from sbyte to int, following the C
29 declare void @test3a(i8, ...)
31 define void @test3(i8 %A, i8 %B) {
32 call void bitcast (void (i8, ...)* @test3a to void (i8, i8)*)( i8 %A, i8 %B
38 ; test conversion of return value...
44 %X = call i32 bitcast (i8 ()* @test4a to i32 ()*)( ) ; <i32> [#uses=1]
49 ; test conversion of return value... no value conversion occurs so we can do
50 ; this with just a prototype...
54 %X = call i32 @test5a( ) ; <i32> [#uses=1]
59 ; test addition of new arguments...
60 declare i32 @test6a(i32)
63 %X = call i32 bitcast (i32 (i32)* @test6a to i32 ()*)( ) ; <i32> [#uses=1]
68 ; test removal of arguments, only can happen with a function body
69 define void @test7a() {
73 define void @test7() {
74 call void bitcast (void ()* @test7a to void (i32)*)( i32 5 )