Merging r258325:
authorHans Wennborg <hans@hanshq.net>
Wed, 20 Jan 2016 21:49:02 +0000 (21:49 +0000)
committerHans Wennborg <hans@hanshq.net>
Wed, 20 Jan 2016 21:49:02 +0000 (21:49 +0000)
commit961a0e424cc7a63ee57cc8506c8a04cbf6012e1f
treec875009870fd063582e4d98079975a118982c21e
parent3acb8d3c6d4e470172fb244c809bc6fdd7948c29
Merging r258325:
------------------------------------------------------------------------
r258325 | spatel | 2016-01-20 09:41:14 -0800 (Wed, 20 Jan 2016) | 21 lines

[LibCallSimplifier] don't get fooled by a fake sqrt()

The test case will crash without this patch because the subsequent call to
hasUnsafeAlgebra() assumes that the call instruction is an FPMathOperator
(ie, returns an FP type).

This part of the function signature check was omitted for the sqrt() case,
but seems to be in place for all other transforms.

Before:
http://reviews.llvm.org/rL257400
...we would have needlessly continued execution in optimizeSqrt(), but the
bug was harmless because we'd eventually fail some other check and return
without damage.

This should fix:
https://llvm.org/bugs/show_bug.cgi?id=26211

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_38@258353 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyLibCalls.cpp
test/Transforms/InstCombine/cos-2.ll