aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/SimplifyLibCalls
diff options
context:
space:
mode:
authorMeador Inge <meadori@codesourcery.com>2012-11-29 15:45:33 +0000
committerMeador Inge <meadori@codesourcery.com>2012-11-29 15:45:33 +0000
commit28d52913ab0cda3fa21a4b16ad87fea4321b5e7e (patch)
tree238f03cb0515b23998ada0e2ae5bf3ba49ba6587 /test/Transforms/SimplifyLibCalls
parent2aac38541708f37f9ddc5b2d3047b68835484a23 (diff)
downloadexternal_llvm-28d52913ab0cda3fa21a4b16ad87fea4321b5e7e.tar.gz
external_llvm-28d52913ab0cda3fa21a4b16ad87fea4321b5e7e.tar.bz2
external_llvm-28d52913ab0cda3fa21a4b16ad87fea4321b5e7e.zip
instcombine: Migrate fprintf optimizations
This patch migrates the fprintf optimizations from the simplify-libcalls pass into the instcombine library call simplifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168891 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/SimplifyLibCalls')
-rw-r--r--test/Transforms/SimplifyLibCalls/FPrintF.ll29
-rw-r--r--test/Transforms/SimplifyLibCalls/iprintf.ll29
-rw-r--r--test/Transforms/SimplifyLibCalls/osx-names.ll30
3 files changed, 0 insertions, 88 deletions
diff --git a/test/Transforms/SimplifyLibCalls/FPrintF.ll b/test/Transforms/SimplifyLibCalls/FPrintF.ll
deleted file mode 100644
index d1410a9468..0000000000
--- a/test/Transforms/SimplifyLibCalls/FPrintF.ll
+++ /dev/null
@@ -1,29 +0,0 @@
-; Test that the FPrintFOptimizer works correctly
-; RUN: opt < %s -simplify-libcalls -S | FileCheck %s
-
-; This transformation requires the pointer size, as it assumes that size_t is
-; the size of a pointer.
-target datalayout = "p:64:64:64"
-
- %struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i32, [52 x i8] }
- %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 }
-@str = constant [3 x i8] c"%s\00" ; <[3 x i8]*> [#uses=1]
-@chr = constant [3 x i8] c"%c\00" ; <[3 x i8]*> [#uses=1]
-@hello = constant [13 x i8] c"hello world\0A\00" ; <[13 x i8]*> [#uses=1]
-@stdout = external global %struct._IO_FILE* ; <%struct._IO_FILE**> [#uses=3]
-
-declare i32 @fprintf(%struct._IO_FILE*, i8*, ...)
-
-; CHECK: define i32 @foo() {
-define i32 @foo() {
-entry:
- %tmp.1 = load %struct._IO_FILE** @stdout ; <%struct._IO_FILE*> [#uses=1]
- %tmp.0 = call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf( %struct._IO_FILE* %tmp.1, i8* getelementptr ([13 x i8]* @hello, i32 0, i32 0) ) ; <i32> [#uses=0]
- %tmp.4 = load %struct._IO_FILE** @stdout ; <%struct._IO_FILE*> [#uses=1]
- %tmp.3 = call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf( %struct._IO_FILE* %tmp.4, i8* getelementptr ([3 x i8]* @str, i32 0, i32 0), i8* getelementptr ([13 x i8]* @hello, i32 0, i32 0) ) ; <i32> [#uses=0]
- %tmp.8 = load %struct._IO_FILE** @stdout ; <%struct._IO_FILE*> [#uses=1]
- %tmp.7 = call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf( %struct._IO_FILE* %tmp.8, i8* getelementptr ([3 x i8]* @chr, i32 0, i32 0), i32 33 ) ; <i32> [#uses=0]
- ret i32 0
-
-; CHECK-NOT: @fprintf(
-}
diff --git a/test/Transforms/SimplifyLibCalls/iprintf.ll b/test/Transforms/SimplifyLibCalls/iprintf.ll
deleted file mode 100644
index 81c1d2fcd9..0000000000
--- a/test/Transforms/SimplifyLibCalls/iprintf.ll
+++ /dev/null
@@ -1,29 +0,0 @@
-; RUN: opt < %s -simplify-libcalls -S -o %t
-; RUN: FileCheck < %t %s
-target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32"
-target triple = "xcore-xmos-elf"
-
-@.str = internal constant [4 x i8] c"%f\0A\00" ; <[4 x i8]*> [#uses=1]
-@.str1 = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
-
-; Verify fprintf with no floating point arguments is transformed to fiprintf
-define i32 @f4(i8* %p, i32 %x) nounwind {
-entry:
-; CHECK: define i32 @f4
-; CHECK: @fiprintf
-; CHECK: }
- %0 = tail call i32 (i8*, i8*, ...)* @fprintf(i8 *%p, i8* getelementptr ([4 x i8]* @.str1, i32 0, i32 0), i32 %x)
- ret i32 %0
-}
-
-; Verify we don't turn this into an fiprintf call
-define i32 @f5(i8* %p, double %x) nounwind {
-entry:
-; CHECK: define i32 @f5
-; CHECK: @fprintf
-; CHECK: }
- %0 = tail call i32 (i8*, i8*, ...)* @fprintf(i8 *%p, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), double %x)
- ret i32 %0
-}
-
-declare i32 @fprintf(i8* nocapture, i8* nocapture, ...) nounwind
diff --git a/test/Transforms/SimplifyLibCalls/osx-names.ll b/test/Transforms/SimplifyLibCalls/osx-names.ll
deleted file mode 100644
index e321d1dd31..0000000000
--- a/test/Transforms/SimplifyLibCalls/osx-names.ll
+++ /dev/null
@@ -1,30 +0,0 @@
-; RUN: opt < %s -simplify-libcalls -S | FileCheck %s
-; <rdar://problem/9815881>
-; On OSX x86-32, fwrite and fputs aren't called fwrite and fputs.
-; Make sure we use the correct names.
-
-target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128"
-target triple = "i386-apple-macosx10.7.2"
-
-%struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
-%struct.__sbuf = type { i8*, i32 }
-%struct.__sFILEX = type opaque
-
-@.str = private unnamed_addr constant [13 x i8] c"Hello world\0A\00", align 1
-@.str2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
-
-define void @test1(%struct.__sFILE* %stream) nounwind {
-; CHECK: define void @test1
-; CHECK: call i32 @"fwrite$UNIX2003"
- %call = tail call i32 (%struct.__sFILE*, i8*, ...)* @fprintf(%struct.__sFILE* %stream, i8* getelementptr inbounds ([13 x i8]* @.str, i32 0, i32 0)) nounwind
- ret void
-}
-
-define void @test2(%struct.__sFILE* %stream, i8* %str) nounwind ssp {
-; CHECK: define void @test2
-; CHECK: call i32 @"fputs$UNIX2003"
- %call = tail call i32 (%struct.__sFILE*, i8*, ...)* @fprintf(%struct.__sFILE* %stream, i8* getelementptr inbounds ([3 x i8]* @.str2, i32 0, i32 0), i8* %str) nounwind
- ret void
-}
-
-declare i32 @fprintf(%struct.__sFILE*, i8*, ...) nounwind