summaryrefslogtreecommitdiffstats
path: root/llvm/test/Regression/Transforms/SimplifyLibCalls/FPrintF.ll
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2005-05-02 23:07:14 +0000
committerReid Spencer <rspencer@reidspencer.com>2005-05-02 23:07:14 +0000
commit59605a1b57ace89462093988faf4d1caf151134a (patch)
tree27d550df8db8f630999448580ce7320247671076 /llvm/test/Regression/Transforms/SimplifyLibCalls/FPrintF.ll
parentc73e633a416fdcec7f3682b04f5af78e147ef30c (diff)
downloadbcm5719-llvm-59605a1b57ace89462093988faf4d1caf151134a.tar.gz
bcm5719-llvm-59605a1b57ace89462093988faf4d1caf151134a.zip
Add a test case for testing the FPrintFOptimization.
llvm-svn: 21656
Diffstat (limited to 'llvm/test/Regression/Transforms/SimplifyLibCalls/FPrintF.ll')
-rw-r--r--llvm/test/Regression/Transforms/SimplifyLibCalls/FPrintF.ll28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/test/Regression/Transforms/SimplifyLibCalls/FPrintF.ll b/llvm/test/Regression/Transforms/SimplifyLibCalls/FPrintF.ll
new file mode 100644
index 00000000000..760eb7f5ff6
--- /dev/null
+++ b/llvm/test/Regression/Transforms/SimplifyLibCalls/FPrintF.ll
@@ -0,0 +1,28 @@
+; Test that the FPrintFOptimizer works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | not grep 'call.*fprintf'
+;
+
+%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] }
+%struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, int }
+
+%str = constant [3 x sbyte] c"%s\00"
+%chr = constant [3 x sbyte] c"%c\00"
+%hello = constant [13 x sbyte] c"hello world\0A\00"
+%stdout = external global %struct._IO_FILE*
+
+declare int %fprintf(%struct._IO_FILE*, sbyte*, ...)
+
+implementation
+
+int %foo()
+{
+entry:
+ %tmp.1 = load %struct._IO_FILE** %stdout
+ %tmp.0 = call int (%struct._IO_FILE*, sbyte*, ...)* %fprintf( %struct._IO_FILE* %tmp.1, sbyte* getelementptr ([13 x sbyte]* %hello, int 0, int 0) )
+ %tmp.4 = load %struct._IO_FILE** %stdout
+ %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) )
+ %tmp.8 = load %struct._IO_FILE** %stdout
+ %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 )
+ ret int 0
+}
+
OpenPOWER on IntegriCloud