summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-07 20:01:38 +0000
committerChris Lattner <sabre@nondot.org>2010-09-07 20:01:38 +0000
commit979ed44feb1be70e641275aaef5460320fab86a3 (patch)
tree4c8b7cb5ad9020dd64c16e19807b41574acb0012 /test
parentdc0b06c8150071f75597a97d43529a5227031858 (diff)
downloadllvm-979ed44feb1be70e641275aaef5460320fab86a3.tar.gz
llvm-979ed44feb1be70e641275aaef5460320fab86a3.tar.bz2
llvm-979ed44feb1be70e641275aaef5460320fab86a3.tar.xz
Fix a serious performance regression introduced by r108687 on linux:
turning (fptrunc (sqrt (fpext x))) -> (sqrtf x) is great, but we have to delete the original sqrt as well. Not doing so causes us to do two sqrt's when building with -fmath-errno (the default on linux). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113260 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/InstCombine/sqrt.ll22
1 files changed, 19 insertions, 3 deletions
diff --git a/test/Transforms/InstCombine/sqrt.ll b/test/Transforms/InstCombine/sqrt.ll
index 6505382048..69e511bfb3 100644
--- a/test/Transforms/InstCombine/sqrt.ll
+++ b/test/Transforms/InstCombine/sqrt.ll
@@ -1,16 +1,32 @@
; RUN: opt -S -instcombine %s | FileCheck %s
-define float @foo(float %x) nounwind readnone ssp {
+define float @test1(float %x) nounwind readnone ssp {
entry:
+; CHECK: @test1
; CHECK-NOT: fpext
; CHECK-NOT: sqrt(
; CHECK: sqrtf(
; CHECK-NOT: fptrunc
%conv = fpext float %x to double ; <double> [#uses=1]
- %call = tail call double @sqrt(double %conv) nounwind ; <double> [#uses=1]
+ %call = tail call double @sqrt(double %conv) readnone nounwind ; <double> [#uses=1]
%conv1 = fptrunc double %call to float ; <float> [#uses=1]
; CHECK: ret float
ret float %conv1
}
-declare double @sqrt(double) readnone
+declare double @sqrt(double)
+
+; PR8096
+define float @test2(float %x) nounwind readnone ssp {
+entry:
+; CHECK: @test2
+; CHECK-NOT: fpext
+; CHECK-NOT: sqrt(
+; CHECK: sqrtf(
+; CHECK-NOT: fptrunc
+ %conv = fpext float %x to double ; <double> [#uses=1]
+ %call = tail call double @sqrt(double %conv) nounwind ; <double> [#uses=1]
+ %conv1 = fptrunc double %call to float ; <float> [#uses=1]
+; CHECK: ret float
+ ret float %conv1
+}