[PATCH] D50112: [Android] Increase default new alignment for Android

Pirama Arumuga Nainar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 1 10:56:02 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC338603: [Android] Increase default new alignment for Android (authored by pirama, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D50112?vs=158402&id=158574#toc

Repository:
  rC Clang

https://reviews.llvm.org/D50112

Files:
  lib/Basic/TargetInfo.cpp
  test/Preprocessor/init.c


Index: lib/Basic/TargetInfo.cpp
===================================================================
--- lib/Basic/TargetInfo.cpp
+++ lib/Basic/TargetInfo.cpp
@@ -63,8 +63,9 @@
   MinGlobalAlign = 0;
   // From the glibc documentation, on GNU systems, malloc guarantees 16-byte
   // alignment on 64-bit systems and 8-byte alignment on 32-bit systems. See
-  // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html
-  if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment())
+  // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html.
+  // This alignment guarantee also applies to Windows and Android.
+  if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid())
     NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0;
   else
     NewAlign = 0; // Infer from basic type alignment.
Index: test/Preprocessor/init.c
===================================================================
--- test/Preprocessor/init.c
+++ test/Preprocessor/init.c
@@ -9019,7 +9019,7 @@
 // ANDROID:#define __ANDROID__ 1
 //
 // RUN: %clang_cc1 -x c++ -triple i686-linux-android -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix I386-ANDROID-CXX %s
-// I386-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 4U
+// I386-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8U
 //
 // RUN: %clang_cc1 -x c++ -triple x86_64-linux-android -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix X86_64-ANDROID-CXX %s
 // X86_64-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50112.158574.patch
Type: text/x-patch
Size: 1557 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180801/1832696e/attachment.bin>


More information about the cfe-commits mailing list