blob: 760eb7f5ff62e8f9815e7c1374a36fd7c0181716 [file] [log] [blame]
Reid Spencer6302abe2005-05-02 23:07:14 +00001; Test that the FPrintFOptimizer works correctly
2; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | not grep 'call.*fprintf'
3;
4
5%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] }
6%struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, int }
7
8%str = constant [3 x sbyte] c"%s\00"
9%chr = constant [3 x sbyte] c"%c\00"
10%hello = constant [13 x sbyte] c"hello world\0A\00"
11%stdout = external global %struct._IO_FILE*
12
13declare int %fprintf(%struct._IO_FILE*, sbyte*, ...)
14
15implementation
16
17int %foo()
18{
19entry:
20 %tmp.1 = load %struct._IO_FILE** %stdout
21 %tmp.0 = call int (%struct._IO_FILE*, sbyte*, ...)* %fprintf( %struct._IO_FILE* %tmp.1, sbyte* getelementptr ([13 x sbyte]* %hello, int 0, int 0) )
22 %tmp.4 = load %struct._IO_FILE** %stdout
23 %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) )
24 %tmp.8 = load %struct._IO_FILE** %stdout
25 %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 )
26 ret int 0
27}
28