1 ; RUN: if as < %s | opt -instcombine -die | dis | grep call | grep cast
8 ; Simple case, argument translatable without changing the value
9 declare void %test1a(sbyte *%A)
10 void %test1(int *%A) {
11 call void(int*)* cast (void(sbyte*)* %test1a to void(int*)*)(int* %A)
15 ; More complex case, translate argument because of resolution. This is safe
16 ; because we have the body of the function
17 void %test2a(sbyte %A) { ret void }
19 call void(int)* cast (void(sbyte)* %test2a to void(int)*)(int %A)
23 ; Resolving this should insert a cast from sbyte to int, following the C
25 declare void %test3a(sbyte %A, ...)
26 void %test3(sbyte %A, sbyte %B) {
27 call void(sbyte, sbyte)* cast (void(sbyte,...)* %test3a to void(sbyte,sbyte)*)(sbyte %A, sbyte %B)
31 ; test conversion of return value...
32 sbyte %test4a() { ret sbyte 0 }
34 %X = call int()* cast (sbyte()* %test4a to int()*)()
38 ; test conversion of return value... no value conversion occurs so we can do
39 ; this with just a prototype...
40 declare uint %test5a()
42 %X = call int()* cast (uint()* %test5a to int()*)()
46 ; test addition of new arguments...
47 declare int %test6a(int %X)
49 %X = call int()* cast (int(int)* %test6a to int()*)()
53 ; test removal of arguments, only can happen with a function body
54 void %test7a() { ret void }
56 call void(int)* cast (void()* %test7a to void(int)*)(int 5)