[PartialInlineLibCalls] Teach PartialInlineLibCalls to honor nobuiltin, properly...
authorCraig Topper <craig.topper@intel.com>
Sat, 28 Oct 2017 00:36:58 +0000 (00:36 +0000)
committerCraig Topper <craig.topper@intel.com>
Sat, 28 Oct 2017 00:36:58 +0000 (00:36 +0000)
commit49687104d6afed98e2eb5d90129d196a4c587add
tree2480824a7eab50ab435f46ec21d547edb31d0c62
parent8e07bd488771eaacaa5281ddcd8e6c734c81c3a6
[PartialInlineLibCalls] Teach PartialInlineLibCalls to honor nobuiltin, properly check the function signature, and check TLI::has

Summary:
We shouldn't do this transformation if the function is marked nobuitlin.

We were only checking that the return type is floating point, we really should be checking the argument types and argument count as well. This can be accomplished by using the other version of getLibFunc that takes the Function and not just the name.

We should also be checking TLI::has since sqrtf is a macro on Windows.

Fixes PR32559.

Reviewers: hfinkel, spatel, davide, efriedma

Reviewed By: davide, efriedma

Subscribers: efriedma, llvm-commits, eraman

Differential Revision: https://reviews.llvm.org/D39381

llvm-svn: 316819
llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
llvm/test/Transforms/PartiallyInlineLibCalls/bad-prototype.ll
llvm/test/Transforms/PartiallyInlineLibCalls/nobuiltin.ll [new file with mode: 0644]