Fix a bunch of issues found in a testcase from 400.perlbench.
[oota-llvm.git] / test / Transforms / SimplifyLibCalls / FPrintF.ll
1 ; Test that the FPrintFOptimizer works correctly
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | \
3 ; RUN:   not grep {call.*fprintf}
4 ;
5
6 %struct._IO_FILE = type { int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct._IO_marker*, %struct._IO_FILE*, int, int, int, ushort, sbyte, [1 x sbyte], sbyte*, long, sbyte*, sbyte*, int, [52 x sbyte] }
7 %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, int }
8
9 %str = constant [3 x sbyte] c"%s\00"            
10 %chr = constant [3 x sbyte] c"%c\00"            
11 %hello = constant [13 x sbyte] c"hello world\0A\00"
12 %stdout = external global %struct._IO_FILE*             
13
14 declare int %fprintf(%struct._IO_FILE*, sbyte*, ...)
15
16 implementation  
17
18 int %foo() 
19 {
20 entry:
21         %tmp.1 = load %struct._IO_FILE** %stdout
22         %tmp.0 = call int (%struct._IO_FILE*, sbyte*, ...)* %fprintf( %struct._IO_FILE* %tmp.1, sbyte* getelementptr ([13 x sbyte]* %hello, int 0, int 0) )
23         %tmp.4 = load %struct._IO_FILE** %stdout
24         %tmp.3 = call int (%struct._IO_FILE*, sbyte*, ...)* %fprintf( %struct._IO_FILE* %tmp.4, sbyte* getelementptr ([3 x sbyte]* %str, int 0, int 0), sbyte* getelementptr ([13 x sbyte]* %hello, int 0, int 0) )
25         %tmp.8 = load %struct._IO_FILE** %stdout
26         %tmp.7 = call int (%struct._IO_FILE*, sbyte*, ...)* %fprintf( %struct._IO_FILE* %tmp.8, sbyte* getelementptr ([3 x sbyte]* %chr, int 0, int 0), int 33 )
27         ret int 0
28 }
29