blob: 53b751f1c1f16189ee9b2ad4ba7682bde5bd97c7 [file] [log] [blame]
Reid Spencer6302abe2005-05-02 23:07:14 +00001; Test that the FPrintFOptimizer works correctly
Reid Spencer43b40032007-04-16 15:31:49 +00002; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | \
3; RUN: not grep {call.*fprintf}
Reid Spencer6302abe2005-05-02 23:07:14 +00004;
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
14declare int %fprintf(%struct._IO_FILE*, sbyte*, ...)
15
16implementation
17
18int %foo()
19{
20entry:
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