Handle sqrt() shrinking in SimplifyLibCalls like any other call
authorSanjay Patel <spatel@rotateright.com>
Thu, 23 Oct 2014 21:52:45 +0000 (21:52 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 23 Oct 2014 21:52:45 +0000 (21:52 +0000)
commitd2153694e0fd8ab155e65b02a821df02b3f30130
treed96b10f6bcff86aeabca001abd61a1cc5a33ce36
parent4d529076b64f943a2badc7bef33a95fdb5433fab
Handle sqrt() shrinking in SimplifyLibCalls like any other call

This patch removes a chunk of special case logic for folding
(float)sqrt((double)x) -> sqrtf(x)
in InstCombineCasts and handles it in the mainstream path of SimplifyLibCalls.

No functional change intended, but I loosened the restriction on the existing
sqrt testcases to allow for this optimization even without unsafe-fp-math because
that's the existing behavior.

I also added a missing test case for not shrinking the llvm.sqrt.f64 intrinsic
in case the result is used as a double.

Differential Revision: http://reviews.llvm.org/D5919

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220514 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCasts.cpp
lib/Transforms/Utils/SimplifyLibCalls.cpp
test/Transforms/InstCombine/double-float-shrink-1.ll