From: Fangrui Song Date: Thu, 11 Aug 2022 17:39:41 +0000 (+0000) Subject: [Support] Remove Log2 workaround for Android API level < 18 X-Git-Tag: upstream/17.0.6~36748 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=57f334d81764ff0f46e5f8b29799e369b68a7918;p=platform%2Fupstream%2Fllvm.git [Support] Remove Log2 workaround for Android API level < 18 The function added by D9467 is unneeded. https://github.com/android/ndk/wiki/Changelog-r24 shows that the NDK has moved forward to at least a minimum target API of 19. Reviewed By: srhines Differential Revision: https://reviews.llvm.org/D131656 --- diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h index 94ecae9..a396e69 100644 --- a/llvm/include/llvm/Support/MathExtras.h +++ b/llvm/include/llvm/Support/MathExtras.h @@ -22,10 +22,6 @@ #include #include -#ifdef __ANDROID_NDK__ -#include -#endif - #ifdef _MSC_VER // Declare these intrinsics manually rather including intrin.h. It's very // expensive, and MathExtras.h is popular. @@ -608,15 +604,6 @@ template constexpr inline size_t CTLog2() { template <> constexpr inline size_t CTLog2<1>() { return 0; } -/// Return the log base 2 of the specified value. -inline double Log2(double Value) { -#if defined(__ANDROID_API__) && __ANDROID_API__ < 18 - return __builtin_log(Value) / __builtin_log(2.0); -#else - return log2(Value); -#endif -} - /// Return the floor log base 2 of the specified value, -1 if the value is zero. /// (32 bit edition.) /// Ex. Log2_32(32) == 5, Log2_32(1) == 0, Log2_32(0) == -1, Log2_32(6) == 2 diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 46c2987..5194d85 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -2150,7 +2150,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name, return ConstantFoldFP(log, APF, Ty); case Intrinsic::log2: // TODO: What about hosts that lack a C99 library? - return ConstantFoldFP(Log2, APF, Ty); + return ConstantFoldFP(log2, APF, Ty); case Intrinsic::log10: // TODO: What about hosts that lack a C99 library? return ConstantFoldFP(log10, APF, Ty); @@ -2279,7 +2279,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name, case LibFunc_log2f_finite: if (!APF.isNegative() && !APF.isZero() && TLI->has(Func)) // TODO: What about hosts that lack a C99 library? - return ConstantFoldFP(Log2, APF, Ty); + return ConstantFoldFP(log2, APF, Ty); break; case LibFunc_log10: case LibFunc_log10f: