[clang] 50d7ecc - [NFC][clang] Improve test coverage for alignment manifestation on aligned allocation functions
Roman Lebedev via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 10 10:50:13 PDT 2021
Author: Roman Lebedev
Date: 2021-09-10T20:49:28+03:00
New Revision: 50d7ecc560b27d258c921abe39211926d46fbcff
URL: https://github.com/llvm/llvm-project/commit/50d7ecc560b27d258c921abe39211926d46fbcff
DIFF: https://github.com/llvm/llvm-project/commit/50d7ecc560b27d258c921abe39211926d46fbcff.diff
LOG: [NFC][clang] Improve test coverage for alignment manifestation on aligned allocation functions
Added:
Modified:
clang/test/CodeGen/alloc-fns-alignment.c
Removed:
################################################################################
diff --git a/clang/test/CodeGen/alloc-fns-alignment.c b/clang/test/CodeGen/alloc-fns-alignment.c
index d2f9b467196a7..1ce0cfbad97b0 100644
--- a/clang/test/CodeGen/alloc-fns-alignment.c
+++ b/clang/test/CodeGen/alloc-fns-alignment.c
@@ -5,12 +5,14 @@
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fno-builtin-malloc -emit-llvm < %s | FileCheck %s --check-prefix=NOBUILTIN-MALLOC
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fno-builtin-calloc -emit-llvm < %s | FileCheck %s --check-prefix=NOBUILTIN-CALLOC
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fno-builtin-realloc -emit-llvm < %s | FileCheck %s --check-prefix=NOBUILTIN-REALLOC
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fno-builtin-aligned_alloc -emit-llvm < %s | FileCheck %s --check-prefix=NOBUILTIN-ALIGNED_ALLOC
typedef __SIZE_TYPE__ size_t;
void *malloc(size_t);
void *calloc(size_t, size_t);
void *realloc(void *, size_t);
+void *aligned_alloc(size_t, size_t);
void *malloc_test(size_t n) {
return malloc(n);
@@ -20,16 +22,59 @@ void *calloc_test(size_t n) {
return calloc(1, n);
}
-void *raalloc_test(void *p, size_t n) {
+void *realloc_test(void *p, size_t n) {
return realloc(p, n);
}
+void *aligned_alloc_variable_test(size_t n, size_t a) {
+ return aligned_alloc(a, n);
+}
+
+void *aligned_alloc_constant_test(size_t n) {
+ return aligned_alloc(8, n);
+}
+
+void *aligned_alloc_large_constant_test(size_t n) {
+ return aligned_alloc(4096, n);
+}
+
+// CHECK-LABEL: @malloc_test
// ALIGN16: align 16 i8* @malloc
+
+// CHECK-LABEL: @calloc_test
// ALIGN16: align 16 i8* @calloc
+
+// CHECK-LABEL: @realloc_test
// ALIGN16: align 16 i8* @realloc
+
+// CHECK-LABEL: @aligned_alloc_variable_test
+// ALIGN16: align 16 i8* @aligned_alloc
+
+// CHECK-LABEL: @aligned_alloc_constant_test
+// ALIGN16: align 16 i8* @aligned_alloc
+
+// CHECK-LABEL: @aligned_alloc_large_constant_test
+// ALIGN16: align 16 i8* @aligned_alloc
+
+// CHECK-LABEL: @malloc_test
// ALIGN8: align 8 i8* @malloc
+
+// CHECK-LABEL: @calloc_test
// ALIGN8: align 8 i8* @calloc
+
+// CHECK-LABEL: @realloc_test
// ALIGN8: align 8 i8* @realloc
+
+// CHECK-LABEL: @aligned_alloc_variable_test
+// ALIGN8: align 8 i8* @aligned_alloc
+
+// CHECK-LABEL: @aligned_alloc_constant_test
+// ALIGN8: align 8 i8* @aligned_alloc
+
+// CHECK-LABEL: @aligned_alloc_large_constant_test
+// ALIGN8: align 8 i8* @aligned_alloc
+
// NOBUILTIN-MALLOC: declare i8* @malloc
// NOBUILTIN-CALLOC: declare i8* @calloc
// NOBUILTIN-REALLOC: declare i8* @realloc
+// NOBUILTIN-ALIGNED_ALLOC: declare i8* @aligned_alloc
More information about the cfe-commits
mailing list