summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/sqrt.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/InstCombine/sqrt.ll')
-rw-r--r--test/Transforms/InstCombine/sqrt.ll21
1 files changed, 19 insertions, 2 deletions
diff --git a/test/Transforms/InstCombine/sqrt.ll b/test/Transforms/InstCombine/sqrt.ll
index 69e511bfb3..6ee7a53ae7 100644
--- a/test/Transforms/InstCombine/sqrt.ll
+++ b/test/Transforms/InstCombine/sqrt.ll
@@ -14,8 +14,6 @@ entry:
ret float %conv1
}
-declare double @sqrt(double)
-
; PR8096
define float @test2(float %x) nounwind readnone ssp {
entry:
@@ -30,3 +28,22 @@ entry:
; CHECK: ret float
ret float %conv1
}
+
+; rdar://9763193
+; Can't fold (fptrunc (sqrt (fpext x))) -> (sqrtf x) since there is another
+; use of sqrt result.
+define float @test3(float* %v) nounwind uwtable ssp {
+entry:
+; CHECK: @test3
+; CHECK: sqrt(
+; CHECK-NOT: sqrtf(
+; CHECK: fptrunc
+ %call34 = call double @sqrt(double undef) nounwind readnone
+ %call36 = call i32 (double)* @foo(double %call34) nounwind
+ %conv38 = fptrunc double %call34 to float
+ ret float %conv38
+}
+
+declare i32 @foo(double)
+
+declare double @sqrt(double) readnone