Convert scripts from using explicit control flow to use the new grep-not script
[oota-llvm.git] / test / Transforms / InstCombine / call.ll
1 ; RUN: as < %s | opt -instcombine -die | dis | grep call | grep-not cast
2
3 implementation
4
5 ; Simple case, argument translatable without changing the value
6 declare void %test1a(sbyte *%A) 
7 void %test1(int *%A) {
8         call void(int*)* cast (void(sbyte*)* %test1a to void(int*)*)(int* %A)
9         ret void
10 }
11
12 ; More complex case, translate argument because of resolution.  This is safe 
13 ; because we have the body of the function
14 void %test2a(sbyte %A) { ret void }
15 int %test2(int %A) {
16         call void(int)* cast (void(sbyte)* %test2a to void(int)*)(int %A)
17         ret int %A
18 }
19
20 ; Resolving this should insert a cast from sbyte to int, following the C 
21 ; promotion rules.
22 declare void %test3a(sbyte %A, ...)
23 void %test3(sbyte %A, sbyte %B) {
24         call void(sbyte, sbyte)* cast (void(sbyte,...)* %test3a to void(sbyte,sbyte)*)(sbyte %A, sbyte %B)
25         ret void
26 }
27
28 ; test conversion of return value...
29 sbyte %test4a() { ret sbyte 0 }
30 int %test4() {
31         %X = call int()* cast (sbyte()* %test4a to int()*)()
32         ret int %X
33 }
34
35 ; test conversion of return value... no value conversion occurs so we can do 
36 ; this with just a prototype...
37 declare uint %test5a()
38 int %test5() {
39         %X = call int()* cast (uint()* %test5a to int()*)()
40         ret int %X
41 }
42
43 ; test addition of new arguments...
44 declare int %test6a(int %X)
45 int %test6() {
46         %X = call int()* cast (int(int)* %test6a to int()*)()
47         ret int %X
48 }
49
50 ; test removal of arguments, only can happen with a function body
51 void %test7a() { ret void } 
52 void %test7() {
53         call void(int)* cast (void()* %test7a to void(int)*)(int 5)
54         ret void
55 }
56