[SimplifyLibCalls] Inline calls to cabs when it's safe to do so
authorHal Finkel <hfinkel@anl.gov>
Sat, 16 Dec 2017 01:26:25 +0000 (01:26 +0000)
committerHal Finkel <hfinkel@anl.gov>
Sat, 16 Dec 2017 01:26:25 +0000 (01:26 +0000)
commit2ff24731bbf905faab6580de7c3e68092ca1ae17
treeb94925a2ab5323a87d297d7e72537838e45fe366
parent7333aa9f16013bf12e9b1947f636d8a4b4586ef0
[SimplifyLibCalls] Inline calls to cabs when it's safe to do so

When unsafe algerbra is allowed calls to cabs(r) can be replaced by:

  sqrt(creal(r)*creal(r) + cimag(r)*cimag(r))

Patch by Paul Walker, thanks!

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

llvm-svn: 320901
llvm/include/llvm/Analysis/TargetLibraryInfo.def
llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h
llvm/lib/Analysis/TargetLibraryInfo.cpp
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
llvm/test/Transforms/InstCombine/cabs-array.ll [new file with mode: 0644]
llvm/test/Transforms/InstCombine/cabs-discrete.ll [new file with mode: 0644]
llvm/unittests/Analysis/TargetLibraryInfoTest.cpp