diff options
author | Richard Osborne <richard@xmos.com> | 2011-03-03 14:20:22 +0000 |
---|---|---|
committer | Richard Osborne <richard@xmos.com> | 2011-03-03 14:20:22 +0000 |
commit | 022708f221e2a9ea1a42c07c7cd7817a8de881dc (patch) | |
tree | f58670ec50e609c0e8c61d41c546550778ec7d5e /test | |
parent | 43b4e23bac43845e519e46e2a050eb907257ae9f (diff) |
Optimize fprintf -> iprintf if there are no floating point arguments
and siprintf is available on the target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126940 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/SimplifyLibCalls/iprintf.ll | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/Transforms/SimplifyLibCalls/iprintf.ll b/test/Transforms/SimplifyLibCalls/iprintf.ll index b99de6efb8..7f036fe3ab 100644 --- a/test/Transforms/SimplifyLibCalls/iprintf.ll +++ b/test/Transforms/SimplifyLibCalls/iprintf.ll @@ -46,5 +46,26 @@ entry: ret i32 %0 } +; 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 @printf(i8* nocapture, ...) nounwind declare i32 @sprintf(i8* nocapture, i8* nocapture, ...) nounwind +declare i32 @fprintf(i8* nocapture, i8* nocapture, ...) nounwind |