[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
diff --git a/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp b/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
index 9d852cf..ef558a4 100644
--- a/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
+++ b/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
@@ -131,6 +131,9 @@
     "declare double @copysign(double, double)\n"
     "declare float @copysignf(float, float)\n"
     "declare x86_fp80 @copysignl(x86_fp80, x86_fp80)\n"
+    "declare double @cabs([2 x double])\n"
+    "declare float @cabsf([2 x float])\n"
+    "declare x86_fp80 @cabsl([2 x x86_fp80])\n"
     "declare double @cos(double)\n"
     "declare float @cosf(float)\n"
     "declare double @cosh(double)\n"