diff options
author | Reid Kleckner <rnk@google.com> | 2017-11-21 01:25:56 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2017-11-21 01:25:56 +0000 |
commit | 13a3d9eb7b898c47765dc1f16e982f407944de1d (patch) | |
tree | c5f18c3d5934e7f93b67fb224b4f81c0222277a0 /clang/test/CodeGenCXX/cxx1z-aligned-allocation.cpp | |
parent | 79708b54f2c1043e28d8d2fb46bb9b416b4806d6 (diff) | |
download | bcm5719-llvm-13a3d9eb7b898c47765dc1f16e982f407944de1d.tar.gz bcm5719-llvm-13a3d9eb7b898c47765dc1f16e982f407944de1d.zip |
[MS] Increase default new alignment for win64 and test it
Summary:
This raises __STDCPP_DEFAULT_NEW_ALIGNMENT__ from 8 to 16 on Win64.
This matches platforms that follow the usual `2 * sizeof(void*)`
alignment requirement for malloc. We might want to consider making that
the default rather than relying on long double alignment.
Fixes PR35356
Reviewers: STL_MSFT, rsmith
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D40277
llvm-svn: 318723
Diffstat (limited to 'clang/test/CodeGenCXX/cxx1z-aligned-allocation.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/cxx1z-aligned-allocation.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/cxx1z-aligned-allocation.cpp b/clang/test/CodeGenCXX/cxx1z-aligned-allocation.cpp index 437597d963b..4c579978cb9 100644 --- a/clang/test/CodeGenCXX/cxx1z-aligned-allocation.cpp +++ b/clang/test/CodeGenCXX/cxx1z-aligned-allocation.cpp @@ -4,6 +4,8 @@ // RUN: %clang_cc1 -std=c++14 -fexceptions -fsized-deallocation -faligned-allocation %s -emit-llvm -triple x86_64-linux-gnu -o - | FileCheck %s // RUN: %clang_cc1 -std=c++1z -fexceptions -fsized-deallocation %s -emit-llvm -triple x86_64-linux-gnu -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++1z -fexceptions -fsized-deallocation %s -emit-llvm -triple x86_64-windows-msvc -o - | FileCheck %s --check-prefix=CHECK-MS + // Check that we don't used aligned (de)allocation without -faligned-allocation or C++1z. // RUN: %clang_cc1 -std=c++14 -DUNALIGNED -fexceptions %s -emit-llvm -triple x86_64-linux-gnu -o - | FileCheck %s --check-prefix=CHECK-UNALIGNED // RUN: %clang_cc1 -std=c++1z -DUNALIGNED -fexceptions -fno-aligned-allocation %s -emit-llvm -triple x86_64-linux-gnu -o - | FileCheck %s --check-prefix=CHECK-UNALIGNED @@ -27,14 +29,28 @@ struct OVERALIGNED A { A(); int n[128]; }; // CHECK-LABEL: define {{.*}} @_Z2a0v() // CHECK: %[[ALLOC:.*]] = call i8* @_ZnwmSt11align_val_t(i64 512, i64 32) // CHECK: call void @_ZdlPvSt11align_val_t(i8* %[[ALLOC]], i64 32) +// CHECK-MS-LABEL: define {{.*}} @"\01?a0@@YAPEAXXZ"() +// CHECK-MS: %[[ALLOC:.*]] = call i8* @"\01??2@YAPEAX_KW4align_val_t@std@@@Z"(i64 512, i64 32) +// CHECK-MS: cleanuppad +// CHECK-MS: call void @"\01??3@YAXPEAXW4align_val_t@std@@@Z"(i8* %[[ALLOC]], i64 32) void *a0() { return new A; } +// FIXME: Why don't we call the sized array deallocation overload in this case? +// The size is known. +// // CHECK-LABEL: define {{.*}} @_Z2a1l( // CHECK: %[[ALLOC:.*]] = call i8* @_ZnamSt11align_val_t(i64 %{{.*}}, i64 32) // No array cookie. // CHECK-NOT: store // CHECK: invoke void @_ZN1AC1Ev( // CHECK: call void @_ZdaPvSt11align_val_t(i8* %[[ALLOC]], i64 32) +// CHECK-MS-LABEL: define {{.*}} @"\01?a1@@YAPEAXJ@Z"( +// CHECK-MS: %[[ALLOC:.*]] = call i8* @"\01??_U@YAPEAX_KW4align_val_t@std@@@Z"(i64 %{{.*}}, i64 32) +// No array cookie. +// CHECK-MS-NOT: store +// CHECK-MS: invoke %struct.A* @"\01??0A@@QEAA@XZ"( +// CHECK-MS: cleanuppad +// CHECK-MS: call void @"\01??_V@YAXPEAXW4align_val_t@std@@@Z"(i8* %[[ALLOC]], i64 32) void *a1(long n) { return new A[n]; } // CHECK-LABEL: define {{.*}} @_Z2a2P1A( |