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

Since r322087, glibc's finite lib calls are generated when possible.
However, they are not supported on Android. This change also
disables other functions not available on Android.

Differential Revision: http://reviews.llvm.org/D42668

llvm-svn: 323898
This commit is contained in:
Chih-Hung Hsieh 2018-01-31 19:12:50 +00:00
parent 7892ae44b4
commit 60d1e79ffb
2 changed files with 30 additions and 12 deletions

View File

@ -397,24 +397,18 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
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);

View File

@ -265,6 +265,30 @@ define void @test_exp2_finite(double %double) #0 {
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