[PATCH] D42668: [Analysis] Disable calls to *_finite and other glibc-only functions on Android.

Chih-Hung Hsieh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 31 11:15:39 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL323898: [Analysis] Disable calls to *_finite and other glibc-only functions on Android. (authored by chh, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D42668?vs=132209&id=132223#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42668

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


Index: llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
===================================================================
--- llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
+++ llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
@@ -397,24 +397,18 @@
     TLI.setUnavailable(LibFunc_flsll);
   }
 
-  // Android uses bionic instead of glibc. So disable some finite
-  // lib calls in glibc for Android. The list of unsupported lib
-  // calls for Android may expand as the need arises.
-  if (T.isAndroid()) {
-    TLI.setUnavailable(LibFunc_exp_finite);
-    TLI.setUnavailable(LibFunc_exp2_finite);
-    TLI.setUnavailable(LibFunc_pow_finite);
-  }
-
-  // The following functions are available on at least Linux:
-  if (!T.isOSLinux()) {
+  // The following functions are available on Linux,
+  // but Android uses bionic instead of glibc.
+  if (!T.isOSLinux() || T.isAndroid()) {
     TLI.setUnavailable(LibFunc_dunder_strdup);
     TLI.setUnavailable(LibFunc_dunder_strtok_r);
     TLI.setUnavailable(LibFunc_dunder_isoc99_scanf);
     TLI.setUnavailable(LibFunc_dunder_isoc99_sscanf);
     TLI.setUnavailable(LibFunc_under_IO_getc);
     TLI.setUnavailable(LibFunc_under_IO_putc);
-    TLI.setUnavailable(LibFunc_memalign);
+    // But, Android has memalign.
+    if (!T.isAndroid())
+      TLI.setUnavailable(LibFunc_memalign);
     TLI.setUnavailable(LibFunc_fopen64);
     TLI.setUnavailable(LibFunc_fseeko64);
     TLI.setUnavailable(LibFunc_fstat64);
Index: llvm/trunk/test/CodeGen/AArch64/illegal-float-ops.ll
===================================================================
--- llvm/trunk/test/CodeGen/AArch64/illegal-float-ops.ll
+++ llvm/trunk/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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42668.132223.patch
Type: text/x-patch
Size: 2654 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180131/bb1f8635/attachment.bin>


More information about the llvm-commits mailing list