Skip to content

Commit 0cebd94

Browse files
committed
fixup! switch clang tests back to manually written
Created using spr 1.3.8-beta.1
2 parents ca51a2b + 946afaa commit 0cebd94

File tree

4 files changed

+73
-411
lines changed

4 files changed

+73
-411
lines changed
Lines changed: 7 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,22 @@
1-
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 6
2-
//
31
// Test optimization pipelines do not interfere with AllocToken lowering, and we
42
// pass on function attributes correctly.
53
//
6-
// RUN: %clang_cc1 -fsanitize=alloc-token -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-O0 %s
7-
// RUN: %clang_cc1 -O1 -fsanitize=alloc-token -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-O1 %s
8-
// RUN: %clang_cc1 -O2 -fsanitize=alloc-token -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-O2 %s
4+
// RUN: %clang_cc1 -fsanitize=alloc-token -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s
5+
// RUN: %clang_cc1 -O1 -fsanitize=alloc-token -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s
6+
// RUN: %clang_cc1 -O2 -fsanitize=alloc-token -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s
97

108
typedef __typeof(sizeof(int)) size_t;
119

1210
void *malloc(size_t size);
1311

14-
// CHECK-O0-LABEL: define dso_local ptr @test_malloc(
15-
// CHECK-O0-SAME: ) #[[ATTR0:[0-9]+]] {
16-
// CHECK-O0-NEXT: [[ENTRY:.*:]]
17-
// CHECK-O0-NEXT: [[TMP0:%.*]] = call ptr @__alloc_token_malloc(i64 noundef 4, i64 0) #[[ATTR3:[0-9]+]]
18-
// CHECK-O0-NEXT: ret ptr [[TMP0]]
19-
//
20-
// CHECK-O1-LABEL: define dso_local noalias noundef ptr @test_malloc(
21-
// CHECK-O1-SAME: ) local_unnamed_addr #[[ATTR0:[0-9]+]] {
22-
// CHECK-O1-NEXT: [[ENTRY:.*:]]
23-
// CHECK-O1-NEXT: [[TMP0:%.*]] = tail call dereferenceable_or_null(4) ptr @__alloc_token_malloc(i64 noundef 4, i64 0) #[[ATTR3:[0-9]+]]
24-
// CHECK-O1-NEXT: ret ptr [[TMP0]]
25-
//
26-
// CHECK-O2-LABEL: define dso_local noalias noundef ptr @test_malloc(
27-
// CHECK-O2-SAME: ) local_unnamed_addr #[[ATTR0:[0-9]+]] {
28-
// CHECK-O2-NEXT: [[ENTRY:.*:]]
29-
// CHECK-O2-NEXT: [[TMP0:%.*]] = tail call dereferenceable_or_null(4) ptr @__alloc_token_malloc(i64 noundef 4, i64 0) #[[ATTR3:[0-9]+]]
30-
// CHECK-O2-NEXT: ret ptr [[TMP0]]
31-
//
12+
// CHECK-LABEL: @test_malloc(
13+
// CHECK: call{{.*}} ptr @__alloc_token_malloc(i64 noundef 4, i64 0)
3214
void *test_malloc() {
3315
return malloc(sizeof(int));
3416
}
3517

36-
// CHECK-O0-LABEL: define dso_local ptr @no_sanitize_malloc(
37-
// CHECK-O0-SAME: i64 noundef [[SIZE:%.*]]) #[[ATTR2:[0-9]+]] {
38-
// CHECK-O0-NEXT: [[ENTRY:.*:]]
39-
// CHECK-O0-NEXT: [[SIZE_ADDR:%.*]] = alloca i64, align 8
40-
// CHECK-O0-NEXT: store i64 [[SIZE]], ptr [[SIZE_ADDR]], align 8
41-
// CHECK-O0-NEXT: [[CALL:%.*]] = call ptr @malloc(i64 noundef 4) #[[ATTR3]]
42-
// CHECK-O0-NEXT: ret ptr [[CALL]]
43-
//
44-
// CHECK-O1-LABEL: define dso_local noalias noundef ptr @no_sanitize_malloc(
45-
// CHECK-O1-SAME: i64 noundef [[SIZE:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] {
46-
// CHECK-O1-NEXT: [[ENTRY:.*:]]
47-
// CHECK-O1-NEXT: [[CALL:%.*]] = tail call dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #[[ATTR3]]
48-
// CHECK-O1-NEXT: ret ptr [[CALL]]
49-
//
50-
// CHECK-O2-LABEL: define dso_local noalias noundef ptr @no_sanitize_malloc(
51-
// CHECK-O2-SAME: i64 noundef [[SIZE:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] {
52-
// CHECK-O2-NEXT: [[ENTRY:.*:]]
53-
// CHECK-O2-NEXT: [[CALL:%.*]] = tail call dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #[[ATTR3]]
54-
// CHECK-O2-NEXT: ret ptr [[CALL]]
55-
//
18+
// CHECK-LABEL: @no_sanitize_malloc(
19+
// CHECK: call{{.*}} ptr @malloc(i64 noundef 4)
5620
void *no_sanitize_malloc(size_t size) __attribute__((no_sanitize("alloc-token"))) {
5721
return malloc(sizeof(int));
5822
}

clang/test/CodeGen/alloc-token.c

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 6
21
// RUN: %clang_cc1 -fsanitize=alloc-token -triple x86_64-linux-gnu -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s
32

43
typedef __typeof(sizeof(int)) size_t;
@@ -16,29 +15,15 @@ int posix_memalign(void **memptr, size_t alignment, size_t size);
1615
void *sink;
1716

1817
// CHECK-LABEL: define dso_local void @test_malloc_like(
19-
// CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
20-
// CHECK-NEXT: [[ENTRY:.*:]]
21-
// CHECK-NEXT: [[CALL:%.*]] = call ptr @malloc(i64 noundef 4) #[[ATTR5:[0-9]+]]
22-
// CHECK-NEXT: store ptr [[CALL]], ptr @sink, align 8
23-
// CHECK-NEXT: [[CALL1:%.*]] = call ptr @calloc(i64 noundef 3, i64 noundef 4) #[[ATTR6:[0-9]+]]
24-
// CHECK-NEXT: store ptr [[CALL1]], ptr @sink, align 8
25-
// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr @sink, align 8
26-
// CHECK-NEXT: [[CALL2:%.*]] = call ptr @realloc(ptr noundef [[TMP0]], i64 noundef 8) #[[ATTR7:[0-9]+]]
27-
// CHECK-NEXT: store ptr [[CALL2]], ptr @sink, align 8
28-
// CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr @sink, align 8
29-
// CHECK-NEXT: [[CALL3:%.*]] = call ptr @reallocarray(ptr noundef [[TMP1]], i64 noundef 5, i64 noundef 8)
30-
// CHECK-NEXT: store ptr [[CALL3]], ptr @sink, align 8
31-
// CHECK-NEXT: [[CALL4:%.*]] = call align 128 ptr @aligned_alloc(i64 noundef 128, i64 noundef 1024) #[[ATTR7]]
32-
// CHECK-NEXT: store ptr [[CALL4]], ptr @sink, align 8
33-
// CHECK-NEXT: [[CALL5:%.*]] = call align 16 ptr @memalign(i64 noundef 16, i64 noundef 256) #[[ATTR7]]
34-
// CHECK-NEXT: store ptr [[CALL5]], ptr @sink, align 8
35-
// CHECK-NEXT: [[CALL6:%.*]] = call ptr @valloc(i64 noundef 4096)
36-
// CHECK-NEXT: store ptr [[CALL6]], ptr @sink, align 8
37-
// CHECK-NEXT: [[CALL7:%.*]] = call ptr @pvalloc(i64 noundef 8192)
38-
// CHECK-NEXT: store ptr [[CALL7]], ptr @sink, align 8
39-
// CHECK-NEXT: [[CALL8:%.*]] = call i32 @posix_memalign(ptr noundef @sink, i64 noundef 64, i64 noundef 4)
40-
// CHECK-NEXT: ret void
41-
//
18+
// CHECK: call ptr @malloc(i64 noundef 4)
19+
// CHECK: call ptr @calloc(i64 noundef 3, i64 noundef 4)
20+
// CHECK: call ptr @realloc(ptr noundef {{.*}}, i64 noundef 8)
21+
// CHECK: call ptr @reallocarray(ptr noundef {{.*}}, i64 noundef 5, i64 noundef 8)
22+
// CHECK: call align 128 ptr @aligned_alloc(i64 noundef 128, i64 noundef 1024)
23+
// CHECK: call align 16 ptr @memalign(i64 noundef 16, i64 noundef 256)
24+
// CHECK: call ptr @valloc(i64 noundef 4096)
25+
// CHECK: call ptr @pvalloc(i64 noundef 8192)
26+
// CHECK: call i32 @posix_memalign(ptr noundef @sink, i64 noundef 64, i64 noundef 4)
4227
void test_malloc_like() {
4328
sink = malloc(sizeof(int));
4429
sink = calloc(3, sizeof(int));

0 commit comments

Comments
 (0)