[PATCH] D42668: [Analysis] Disable log/log2/log10 finite lib calls on Android with -ffast-math.

Chih-Hung Hsieh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 15:43:41 PST 2018


chh created this revision.
chh added reviewers: srhines, minseong.kim.

Since r322087, glibc's finite lib calls are generated when possible.
However, glibc is not supported on Android. Therefore this change
enables llvm to finely distinguish between linux and Android for
unsupported library calls. The change also include some regression
tests.


https://reviews.llvm.org/D42668

Files:
  lib/Analysis/TargetLibraryInfo.cpp
  test/CodeGen/AArch64/illegal-float-ops.ll


Index: test/CodeGen/AArch64/illegal-float-ops.ll
===================================================================
--- test/CodeGen/AArch64/illegal-float-ops.ll
+++ test/CodeGen/AArch64/illegal-float-ops.ll
@@ -265,6 +265,30 @@
   ret void
 }
 
+define void @test_log_finite(double %double) #0 {
+  %logdouble = call double @llvm.log.f64(double %double)
+  store double %logdouble, double* @vardouble
+  ; ANDROID-AARCH64-NOT: bl __log_finite
+  ; CHECK: bl __log_finite
+  ret void
+}
+
+define void @test_log2_finite(double %double) #0 {
+  %log2double = call double @llvm.log2.f64(double %double)
+  store double %log2double, double* @vardouble
+  ; ANDROID-AARCH64-NOT: bl __log2_finite
+  ; CHECK: bl __log2_finite
+  ret void
+}
+
+define void @test_log10_finite(double %double) #0 {
+  %log10double = call double @llvm.log10.f64(double %double)
+  store double %log10double, double* @vardouble
+  ; ANDROID-AARCH64-NOT: bl __log10_finite
+  ; CHECK: bl __log10_finite
+  ret void
+}
+
 define void @test_pow_finite(double %double) #0 {
   %powdouble = call double @llvm.pow.f64(double %double, double %double)
   store double %powdouble, double* @vardouble
Index: lib/Analysis/TargetLibraryInfo.cpp
===================================================================
--- lib/Analysis/TargetLibraryInfo.cpp
+++ lib/Analysis/TargetLibraryInfo.cpp
@@ -403,6 +403,9 @@
   if (T.isAndroid()) {
     TLI.setUnavailable(LibFunc_exp_finite);
     TLI.setUnavailable(LibFunc_exp2_finite);
+    TLI.setUnavailable(LibFunc_log_finite);
+    TLI.setUnavailable(LibFunc_log2_finite);
+    TLI.setUnavailable(LibFunc_log10_finite);
     TLI.setUnavailable(LibFunc_pow_finite);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42668.131890.patch
Type: text/x-patch
Size: 1679 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180129/50fc0979/attachment.bin>


More information about the llvm-commits mailing list