Ignore stderr for some more tests that expect warnings there.
[oota-llvm.git] / test / Transforms / InstCombine / call.ll
1 ; Ignore stderr, we expect warnings there
2 ; RUN: llvm-as < %s 2> /dev/null | opt -instcombine | llvm-dis | \
3 ; RUN:    grep call | notcast
4 ; END.
5
6
7 ; Simple case, argument translatable without changing the value
8 declare void @test1a(i8*)
9
10 define void @test1(i32* %A) {
11         call void bitcast (void (i8*)* @test1a to void (i32*)*)( i32* %A )
12         ret void
13 }
14
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) {
18         ret void
19 }
20
21 define i32 @test2(i32 %A) {
22         call void bitcast (void (i8)* @test2a to void (i32)*)( i32 %A )
23         ret i32 %A
24 }
25
26
27 ; Resolving this should insert a cast from sbyte to int, following the C 
28 ; promotion rules.
29 declare void @test3a(i8, ...)
30
31 define void @test3(i8 %A, i8 %B) {
32         call void bitcast (void (i8, ...)* @test3a to void (i8, i8)*)( i8 %A, i8 %B 
33 )
34         ret void
35 }
36
37
38 ; test conversion of return value...
39 define i8 @test4a() {
40         ret i8 0
41 }
42
43 define i32 @test4() {
44         %X = call i32 bitcast (i8 ()* @test4a to i32 ()*)( )            ; <i32> [#uses=1]
45         ret i32 %X
46 }
47
48
49 ; test conversion of return value... no value conversion occurs so we can do 
50 ; this with just a prototype...
51 declare i32 @test5a()
52
53 define i32 @test5() {
54         %X = call i32 @test5a( )                ; <i32> [#uses=1]
55         ret i32 %X
56 }
57
58
59 ; test addition of new arguments...
60 declare i32 @test6a(i32)
61
62 define i32 @test6() {
63         %X = call i32 bitcast (i32 (i32)* @test6a to i32 ()*)( )                ; <i32> [#uses=1]
64         ret i32 %X
65 }
66
67
68 ; test removal of arguments, only can happen with a function body
69 define void @test7a() {
70         ret void
71 }
72
73 define void @test7() {
74         call void bitcast (void ()* @test7a to void (i32)*)( i32 5 )
75         ret void
76 }
77
78