[clang] 0b01e3d - clang: Convert builtins test to opaque pointers
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 5 06:01:58 PST 2022
Author: Matt Arsenault
Date: 2022-12-05T09:01:52-05:00
New Revision: 0b01e3d0ae1f81b7e823397ed5a452025e8a751b
URL: https://github.com/llvm/llvm-project/commit/0b01e3d0ae1f81b7e823397ed5a452025e8a751b
DIFF: https://github.com/llvm/llvm-project/commit/0b01e3d0ae1f81b7e823397ed5a452025e8a751b.diff
LOG: clang: Convert builtins test to opaque pointers
Added:
Modified:
clang/test/CodeGen/builtins.c
Removed:
################################################################################
diff --git a/clang/test/CodeGen/builtins.c b/clang/test/CodeGen/builtins.c
index eb522db917ae..9420b26da329 100644
--- a/clang/test/CodeGen/builtins.c
+++ b/clang/test/CodeGen/builtins.c
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -no-opaque-pointers -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// RUN: not grep __builtin %t
-// RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple x86_64-darwin-apple | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple x86_64-darwin-apple -o - %s | FileCheck %s
int printf(const char *, ...);
@@ -433,10 +433,10 @@ void test_float_builtin_ops(float F, double D, long double LD) {
// __builtin_longjmp isn't supported on all platforms, so only test it on X86.
#ifdef __x86_64__
-// CHECK-LABEL: define{{.*}} void @test_builtin_longjmp
+// CHECK-LABEL: define{{.*}} void @test_builtin_longjmp(ptr{{.*}}
void test_builtin_longjmp(void **buffer) {
- // CHECK: [[BITCAST:%.*]] = bitcast
- // CHECK-NEXT: call void @llvm.eh.sjlj.longjmp(i8* [[BITCAST]])
+ // CHECK: [[LOAD:%[a-z0-9]+]] = load ptr, ptr
+ // CHECK-NEXT: call void @llvm.eh.sjlj.longjmp(ptr [[LOAD]])
__builtin_longjmp(buffer, 1);
// CHECK-NEXT: unreachable
}
@@ -445,13 +445,13 @@ void test_builtin_longjmp(void **buffer) {
// CHECK-LABEL: define{{.*}} void @test_memory_builtins
void test_memory_builtins(int n) {
- // CHECK: call i8* @malloc
+ // CHECK: call ptr @malloc
void * p = __builtin_malloc(n);
// CHECK: call void @free
__builtin_free(p);
- // CHECK: call i8* @calloc
+ // CHECK: call ptr @calloc
p = __builtin_calloc(1, n);
- // CHECK: call i8* @realloc
+ // CHECK: call ptr @realloc
p = __builtin_realloc(p, n);
// CHECK: call void @free
__builtin_free(p);
@@ -466,9 +466,9 @@ long long test_builtin_readcyclecounter(void) {
/// __builtin_launder should be a NOP in C since there are no vtables.
// CHECK-LABEL: define{{.*}} void @test_builtin_launder
void test_builtin_launder(int *p) {
- // CHECK: [[TMP:%.*]] = load i32*,
+ // CHECK: [[TMP:%.*]] = load ptr,
// CHECK-NOT: @llvm.launder
- // CHECK: store i32* [[TMP]],
+ // CHECK: store ptr [[TMP]],
int *d = __builtin_launder(p);
}
@@ -483,27 +483,27 @@ void test___warn_memset_zero_len(void) {
#ifdef __x86_64__
// CHECK-LABEL: define{{.*}} void @test_builtin_os_log
-// CHECK: (i8* noundef %[[BUF:.*]], i32 noundef %[[I:.*]], i8* noundef %[[DATA:.*]])
+// CHECK: (ptr noundef %[[BUF:.*]], i32 noundef %[[I:.*]], ptr noundef %[[DATA:.*]])
void test_builtin_os_log(void *buf, int i, const char *data) {
volatile int len;
- // CHECK: %[[BUF_ADDR:.*]] = alloca i8*, align 8
+ // CHECK: %[[BUF_ADDR:.*]] = alloca ptr, align 8
// CHECK: %[[I_ADDR:.*]] = alloca i32, align 4
- // CHECK: %[[DATA_ADDR:.*]] = alloca i8*, align 8
+ // CHECK: %[[DATA_ADDR:.*]] = alloca ptr, align 8
// CHECK: %[[LEN:.*]] = alloca i32, align 4
- // CHECK: store i8* %[[BUF]], i8** %[[BUF_ADDR]], align 8
- // CHECK: store i32 %[[I]], i32* %[[I_ADDR]], align 4
- // CHECK: store i8* %[[DATA]], i8** %[[DATA_ADDR]], align 8
+ // CHECK: store ptr %[[BUF]], ptr %[[BUF_ADDR]], align 8
+ // CHECK: store i32 %[[I]], ptr %[[I_ADDR]], align 4
+ // CHECK: store ptr %[[DATA]], ptr %[[DATA_ADDR]], align 8
- // CHECK: store volatile i32 34, i32* %[[LEN]]
+ // CHECK: store volatile i32 34, ptr %[[LEN]]
len = __builtin_os_log_format_buffer_size("%d %{public}s %{private}.16P", i, data, data);
- // CHECK: %[[V1:.*]] = load i8*, i8** %[[BUF_ADDR]]
- // CHECK: %[[V2:.*]] = load i32, i32* %[[I_ADDR]]
- // CHECK: %[[V3:.*]] = load i8*, i8** %[[DATA_ADDR]]
- // CHECK: %[[V4:.*]] = ptrtoint i8* %[[V3]] to i64
- // CHECK: %[[V5:.*]] = load i8*, i8** %[[DATA_ADDR]]
- // CHECK: %[[V6:.*]] = ptrtoint i8* %[[V5]] to i64
- // CHECK: call void @__os_log_helper_1_3_4_4_0_8_34_4_17_8_49(i8* noundef %[[V1]], i32 noundef %[[V2]], i64 noundef %[[V4]], i32 noundef 16, i64 noundef %[[V6]])
+ // CHECK: %[[V1:.*]] = load ptr, ptr %[[BUF_ADDR]]
+ // CHECK: %[[V2:.*]] = load i32, ptr %[[I_ADDR]]
+ // CHECK: %[[V3:.*]] = load ptr, ptr %[[DATA_ADDR]]
+ // CHECK: %[[V4:.*]] = ptrtoint ptr %[[V3]] to i64
+ // CHECK: %[[V5:.*]] = load ptr, ptr %[[DATA_ADDR]]
+ // CHECK: %[[V6:.*]] = ptrtoint ptr %[[V5]] to i64
+ // CHECK: call void @__os_log_helper_1_3_4_4_0_8_34_4_17_8_49(ptr noundef %[[V1]], i32 noundef %[[V2]], i64 noundef %[[V4]], i32 noundef 16, i64 noundef %[[V6]])
__builtin_os_log_format(buf, "%d %{public}s %{private}.16P", i, data, data);
// privacy annotations aren't recognized when they are preceded or followed
@@ -538,13 +538,13 @@ void test_builtin_os_log(void *buf, int i, const char *data) {
__builtin_os_log_format(buf, "%{ private, sensitive, private, public}s",
"abc");
- // CHECK: store volatile i32 22, i32* %[[LEN]], align 4
+ // CHECK: store volatile i32 22, ptr %[[LEN]], align 4
len = __builtin_os_log_format_buffer_size("%{mask.xyz}s", "abc");
- // CHECK: call void @__os_log_helper_1_2_2_8_112_8_34(i8* noundef {{.*}}, i64 noundef 8026488
+ // CHECK: call void @__os_log_helper_1_2_2_8_112_8_34(ptr noundef {{.*}}, i64 noundef 8026488
__builtin_os_log_format(buf, "%{mask.xyz, public}s", "abc");
- // CHECK: call void @__os_log_helper_1_3_2_8_112_4_1(i8* noundef {{.*}}, i64 noundef 8026488
+ // CHECK: call void @__os_log_helper_1_3_2_8_112_4_1(ptr noundef {{.*}}, i64 noundef 8026488
__builtin_os_log_format(buf, "%{ mask.xyz, private }d", 11);
// Mask type is silently ignored.
@@ -556,267 +556,256 @@ void test_builtin_os_log(void *buf, int i, const char *data) {
}
// CHECK-LABEL: define linkonce_odr hidden void @__os_log_helper_1_3_4_4_0_8_34_4_17_8_49
-// CHECK: (i8* noundef %[[BUFFER:.*]], i32 noundef %[[ARG0:.*]], i64 noundef %[[ARG1:.*]], i32 noundef %[[ARG2:.*]], i64 noundef %[[ARG3:.*]])
+// CHECK: (ptr noundef %[[BUFFER:.*]], i32 noundef %[[ARG0:.*]], i64 noundef %[[ARG1:.*]], i32 noundef %[[ARG2:.*]], i64 noundef %[[ARG3:.*]])
-// CHECK: %[[BUFFER_ADDR:.*]] = alloca i8*, align 8
+// CHECK: %[[BUFFER_ADDR:.*]] = alloca ptr, align 8
// CHECK: %[[ARG0_ADDR:.*]] = alloca i32, align 4
// CHECK: %[[ARG1_ADDR:.*]] = alloca i64, align 8
// CHECK: %[[ARG2_ADDR:.*]] = alloca i32, align 4
// CHECK: %[[ARG3_ADDR:.*]] = alloca i64, align 8
-// CHECK: store i8* %[[BUFFER]], i8** %[[BUFFER_ADDR]], align 8
-// CHECK: store i32 %[[ARG0]], i32* %[[ARG0_ADDR]], align 4
-// CHECK: store i64 %[[ARG1]], i64* %[[ARG1_ADDR]], align 8
-// CHECK: store i32 %[[ARG2]], i32* %[[ARG2_ADDR]], align 4
-// CHECK: store i64 %[[ARG3]], i64* %[[ARG3_ADDR]], align 8
-// CHECK: %[[BUF:.*]] = load i8*, i8** %[[BUFFER_ADDR]], align 8
-// CHECK: %[[SUMMARY:.*]] = getelementptr i8, i8* %[[BUF]], i64 0
-// CHECK: store i8 3, i8* %[[SUMMARY]], align 1
-// CHECK: %[[NUMARGS:.*]] = getelementptr i8, i8* %[[BUF]], i64 1
-// CHECK: store i8 4, i8* %[[NUMARGS]], align 1
-// CHECK: %[[ARGDESCRIPTOR:.*]] = getelementptr i8, i8* %[[BUF]], i64 2
-// CHECK: store i8 0, i8* %[[ARGDESCRIPTOR]], align 1
-// CHECK: %[[ARGSIZE:.*]] = getelementptr i8, i8* %[[BUF]], i64 3
-// CHECK: store i8 4, i8* %[[ARGSIZE]], align 1
-// CHECK: %[[ARGDATA:.*]] = getelementptr i8, i8* %[[BUF]], i64 4
-// CHECK: %[[ARGDATACAST:.*]] = bitcast i8* %[[ARGDATA]] to i32*
-// CHECK: %[[V0:.*]] = load i32, i32* %[[ARG0_ADDR]], align 4
-// CHECK: store i32 %[[V0]], i32* %[[ARGDATACAST]], align 1
-// CHECK: %[[ARGDESCRIPTOR1:.*]] = getelementptr i8, i8* %[[BUF]], i64 8
-// CHECK: store i8 34, i8* %[[ARGDESCRIPTOR1]], align 1
-// CHECK: %[[ARGSIZE2:.*]] = getelementptr i8, i8* %[[BUF]], i64 9
-// CHECK: store i8 8, i8* %[[ARGSIZE2]], align 1
-// CHECK: %[[ARGDATA3:.*]] = getelementptr i8, i8* %[[BUF]], i64 10
-// CHECK: %[[ARGDATACAST4:.*]] = bitcast i8* %[[ARGDATA3]] to i64*
-// CHECK: %[[V1:.*]] = load i64, i64* %[[ARG1_ADDR]], align 8
-// CHECK: store i64 %[[V1]], i64* %[[ARGDATACAST4]], align 1
-// CHECK: %[[ARGDESCRIPTOR5:.*]] = getelementptr i8, i8* %[[BUF]], i64 18
-// CHECK: store i8 17, i8* %[[ARGDESCRIPTOR5]], align 1
-// CHECK: %[[ARGSIZE6:.*]] = getelementptr i8, i8* %[[BUF]], i64 19
-// CHECK: store i8 4, i8* %[[ARGSIZE6]], align 1
-// CHECK: %[[ARGDATA7:.*]] = getelementptr i8, i8* %[[BUF]], i64 20
-// CHECK: %[[ARGDATACAST8:.*]] = bitcast i8* %[[ARGDATA7]] to i32*
-// CHECK: %[[V2:.*]] = load i32, i32* %[[ARG2_ADDR]], align 4
-// CHECK: store i32 %[[V2]], i32* %[[ARGDATACAST8]], align 1
-// CHECK: %[[ARGDESCRIPTOR9:.*]] = getelementptr i8, i8* %[[BUF]], i64 24
-// CHECK: store i8 49, i8* %[[ARGDESCRIPTOR9]], align 1
-// CHECK: %[[ARGSIZE10:.*]] = getelementptr i8, i8* %[[BUF]], i64 25
-// CHECK: store i8 8, i8* %[[ARGSIZE10]], align 1
-// CHECK: %[[ARGDATA11:.*]] = getelementptr i8, i8* %[[BUF]], i64 26
-// CHECK: %[[ARGDATACAST12:.*]] = bitcast i8* %[[ARGDATA11]] to i64*
-// CHECK: %[[V3:.*]] = load i64, i64* %[[ARG3_ADDR]], align 8
-// CHECK: store i64 %[[V3]], i64* %[[ARGDATACAST12]], align 1
+// CHECK: store ptr %[[BUFFER]], ptr %[[BUFFER_ADDR]], align 8
+// CHECK: store i32 %[[ARG0]], ptr %[[ARG0_ADDR]], align 4
+// CHECK: store i64 %[[ARG1]], ptr %[[ARG1_ADDR]], align 8
+// CHECK: store i32 %[[ARG2]], ptr %[[ARG2_ADDR]], align 4
+// CHECK: store i64 %[[ARG3]], ptr %[[ARG3_ADDR]], align 8
+// CHECK: %[[BUF:.*]] = load ptr, ptr %[[BUFFER_ADDR]], align 8
+// CHECK: %[[SUMMARY:.*]] = getelementptr i8, ptr %[[BUF]], i64 0
+// CHECK: store i8 3, ptr %[[SUMMARY]], align 1
+// CHECK: %[[NUMARGS:.*]] = getelementptr i8, ptr %[[BUF]], i64 1
+// CHECK: store i8 4, ptr %[[NUMARGS]], align 1
+// CHECK: %[[ARGDESCRIPTOR:.*]] = getelementptr i8, ptr %[[BUF]], i64 2
+// CHECK: store i8 0, ptr %[[ARGDESCRIPTOR]], align 1
+// CHECK: %[[ARGSIZE:.*]] = getelementptr i8, ptr %[[BUF]], i64 3
+// CHECK: store i8 4, ptr %[[ARGSIZE]], align 1
+// CHECK: %[[ARGDATA:.*]] = getelementptr i8, ptr %[[BUF]], i64 4
+// CHECK: %[[V0:.*]] = load i32, ptr %[[ARG0_ADDR]], align 4
+// CHECK: store i32 %[[V0]], ptr %[[ARGDATA]], align 1
+// CHECK: %[[ARGDESCRIPTOR1:.*]] = getelementptr i8, ptr %[[BUF]], i64 8
+// CHECK: store i8 34, ptr %[[ARGDESCRIPTOR1]], align 1
+// CHECK: %[[ARGSIZE2:.*]] = getelementptr i8, ptr %[[BUF]], i64 9
+// CHECK: store i8 8, ptr %[[ARGSIZE2]], align 1
+// CHECK: %[[ARGDATA3:.*]] = getelementptr i8, ptr %[[BUF]], i64 10
+// CHECK: %[[V1:.*]] = load i64, ptr %[[ARG1_ADDR]], align 8
+// CHECK: store i64 %[[V1]], ptr %[[ARGDATA3]], align 1
+// CHECK: %[[ARGDESCRIPTOR5:.*]] = getelementptr i8, ptr %[[BUF]], i64 18
+// CHECK: store i8 17, ptr %[[ARGDESCRIPTOR5]], align 1
+// CHECK: %[[ARGSIZE6:.*]] = getelementptr i8, ptr %[[BUF]], i64 19
+// CHECK: store i8 4, ptr %[[ARGSIZE6]], align 1
+// CHECK: %[[ARGDATA7:.*]] = getelementptr i8, ptr %[[BUF]], i64 20
+// CHECK: %[[V2:.*]] = load i32, ptr %[[ARG2_ADDR]], align 4
+// CHECK: store i32 %[[V2]], ptr %[[ARGDATA7]], align 1
+// CHECK: %[[ARGDESCRIPTOR9:.*]] = getelementptr i8, ptr %[[BUF]], i64 24
+// CHECK: store i8 49, ptr %[[ARGDESCRIPTOR9]], align 1
+// CHECK: %[[ARGSIZE10:.*]] = getelementptr i8, ptr %[[BUF]], i64 25
+// CHECK: store i8 8, ptr %[[ARGSIZE10]], align 1
+// CHECK: %[[ARGDATA11:.*]] = getelementptr i8, ptr %[[BUF]], i64 26
+// CHECK: %[[V3:.*]] = load i64, ptr %[[ARG3_ADDR]], align 8
+// CHECK: store i64 %[[V3]], ptr %[[ARGDATA11]], align 1
// CHECK-LABEL: define{{.*}} void @test_builtin_os_log_wide
-// CHECK: (i8* noundef %[[BUF:.*]], i8* noundef %[[DATA:.*]], i32* noundef %[[STR:.*]])
+// CHECK: (ptr noundef %[[BUF:.*]], ptr noundef %[[DATA:.*]], ptr noundef %[[STR:.*]])
typedef int wchar_t;
void test_builtin_os_log_wide(void *buf, const char *data, wchar_t *str) {
volatile int len;
- // CHECK: %[[BUF_ADDR:.*]] = alloca i8*, align 8
- // CHECK: %[[DATA_ADDR:.*]] = alloca i8*, align 8
- // CHECK: %[[STR_ADDR:.*]] = alloca i32*, align 8
+ // CHECK: %[[BUF_ADDR:.*]] = alloca ptr, align 8
+ // CHECK: %[[DATA_ADDR:.*]] = alloca ptr, align 8
+ // CHECK: %[[STR_ADDR:.*]] = alloca ptr, align 8
// CHECK: %[[LEN:.*]] = alloca i32, align 4
- // CHECK: store i8* %[[BUF]], i8** %[[BUF_ADDR]], align 8
- // CHECK: store i8* %[[DATA]], i8** %[[DATA_ADDR]], align 8
- // CHECK: store i32* %[[STR]], i32** %[[STR_ADDR]], align 8
+ // CHECK: store ptr %[[BUF]], ptr %[[BUF_ADDR]], align 8
+ // CHECK: store ptr %[[DATA]], ptr %[[DATA_ADDR]], align 8
+ // CHECK: store ptr %[[STR]], ptr %[[STR_ADDR]], align 8
- // CHECK: store volatile i32 12, i32* %[[LEN]], align 4
+ // CHECK: store volatile i32 12, ptr %[[LEN]], align 4
len = __builtin_os_log_format_buffer_size("%S", str);
- // CHECK: %[[V1:.*]] = load i8*, i8** %[[BUF_ADDR]], align 8
- // CHECK: %[[V2:.*]] = load i32*, i32** %[[STR_ADDR]], align 8
- // CHECK: %[[V3:.*]] = ptrtoint i32* %[[V2]] to i64
- // CHECK: call void @__os_log_helper_1_2_1_8_80(i8* noundef %[[V1]], i64 noundef %[[V3]])
+ // CHECK: %[[V1:.*]] = load ptr, ptr %[[BUF_ADDR]], align 8
+ // CHECK: %[[V2:.*]] = load ptr, ptr %[[STR_ADDR]], align 8
+ // CHECK: %[[V3:.*]] = ptrtoint ptr %[[V2]] to i64
+ // CHECK: call void @__os_log_helper_1_2_1_8_80(ptr noundef %[[V1]], i64 noundef %[[V3]])
__builtin_os_log_format(buf, "%S", str);
}
// CHECK-LABEL: define linkonce_odr hidden void @__os_log_helper_1_2_1_8_80
-// CHECK: (i8* noundef %[[BUFFER:.*]], i64 noundef %[[ARG0:.*]])
+// CHECK: (ptr noundef %[[BUFFER:.*]], i64 noundef %[[ARG0:.*]])
-// CHECK: %[[BUFFER_ADDR:.*]] = alloca i8*, align 8
+// CHECK: %[[BUFFER_ADDR:.*]] = alloca ptr, align 8
// CHECK: %[[ARG0_ADDR:.*]] = alloca i64, align 8
-// CHECK: store i8* %[[BUFFER]], i8** %[[BUFFER_ADDR]], align 8
-// CHECK: store i64 %[[ARG0]], i64* %[[ARG0_ADDR]], align 8
-// CHECK: %[[BUF:.*]] = load i8*, i8** %[[BUFFER_ADDR]], align 8
-// CHECK: %[[SUMMARY:.*]] = getelementptr i8, i8* %[[BUF]], i64 0
-// CHECK: store i8 2, i8* %[[SUMMARY]], align 1
-// CHECK: %[[NUMARGS:.*]] = getelementptr i8, i8* %[[BUF]], i64 1
-// CHECK: store i8 1, i8* %[[NUMARGS]], align 1
-// CHECK: %[[ARGDESCRIPTOR:.*]] = getelementptr i8, i8* %[[BUF]], i64 2
-// CHECK: store i8 80, i8* %[[ARGDESCRIPTOR]], align 1
-// CHECK: %[[ARGSIZE:.*]] = getelementptr i8, i8* %[[BUF]], i64 3
-// CHECK: store i8 8, i8* %[[ARGSIZE]], align 1
-// CHECK: %[[ARGDATA:.*]] = getelementptr i8, i8* %[[BUF]], i64 4
-// CHECK: %[[ARGDATACAST:.*]] = bitcast i8* %[[ARGDATA]] to i64*
-// CHECK: %[[V0:.*]] = load i64, i64* %[[ARG0_ADDR]], align 8
-// CHECK: store i64 %[[V0]], i64* %[[ARGDATACAST]], align 1
+// CHECK: store ptr %[[BUFFER]], ptr %[[BUFFER_ADDR]], align 8
+// CHECK: store i64 %[[ARG0]], ptr %[[ARG0_ADDR]], align 8
+// CHECK: %[[BUF:.*]] = load ptr, ptr %[[BUFFER_ADDR]], align 8
+// CHECK: %[[SUMMARY:.*]] = getelementptr i8, ptr %[[BUF]], i64 0
+// CHECK: store i8 2, ptr %[[SUMMARY]], align 1
+// CHECK: %[[NUMARGS:.*]] = getelementptr i8, ptr %[[BUF]], i64 1
+// CHECK: store i8 1, ptr %[[NUMARGS]], align 1
+// CHECK: %[[ARGDESCRIPTOR:.*]] = getelementptr i8, ptr %[[BUF]], i64 2
+// CHECK: store i8 80, ptr %[[ARGDESCRIPTOR]], align 1
+// CHECK: %[[ARGSIZE:.*]] = getelementptr i8, ptr %[[BUF]], i64 3
+// CHECK: store i8 8, ptr %[[ARGSIZE]], align 1
+// CHECK: %[[ARGDATA:.*]] = getelementptr i8, ptr %[[BUF]], i64 4
+// CHECK: %[[V0:.*]] = load i64, ptr %[[ARG0_ADDR]], align 8
+// CHECK: store i64 %[[V0]], ptr %[[ARGDATA]], align 1
// CHECK-LABEL: define{{.*}} void @test_builtin_os_log_precision_width
-// CHECK: (i8* noundef %[[BUF:.*]], i8* noundef %[[DATA:.*]], i32 noundef %[[PRECISION:.*]], i32 noundef %[[WIDTH:.*]])
+// CHECK: (ptr noundef %[[BUF:.*]], ptr noundef %[[DATA:.*]], i32 noundef %[[PRECISION:.*]], i32 noundef %[[WIDTH:.*]])
void test_builtin_os_log_precision_width(void *buf, const char *data,
int precision, int width) {
volatile int len;
- // CHECK: %[[BUF_ADDR:.*]] = alloca i8*, align 8
- // CHECK: %[[DATA_ADDR:.*]] = alloca i8*, align 8
+ // CHECK: %[[BUF_ADDR:.*]] = alloca ptr, align 8
+ // CHECK: %[[DATA_ADDR:.*]] = alloca ptr, align 8
// CHECK: %[[PRECISION_ADDR:.*]] = alloca i32, align 4
// CHECK: %[[WIDTH_ADDR:.*]] = alloca i32, align 4
// CHECK: %[[LEN:.*]] = alloca i32, align 4
- // CHECK: store i8* %[[BUF]], i8** %[[BUF_ADDR]], align 8
- // CHECK: store i8* %[[DATA]], i8** %[[DATA_ADDR]], align 8
- // CHECK: store i32 %[[PRECISION]], i32* %[[PRECISION_ADDR]], align 4
- // CHECK: store i32 %[[WIDTH]], i32* %[[WIDTH_ADDR]], align 4
+ // CHECK: store ptr %[[BUF]], ptr %[[BUF_ADDR]], align 8
+ // CHECK: store ptr %[[DATA]], ptr %[[DATA_ADDR]], align 8
+ // CHECK: store i32 %[[PRECISION]], ptr %[[PRECISION_ADDR]], align 4
+ // CHECK: store i32 %[[WIDTH]], ptr %[[WIDTH_ADDR]], align 4
- // CHECK: store volatile i32 24, i32* %[[LEN]], align 4
+ // CHECK: store volatile i32 24, ptr %[[LEN]], align 4
len = __builtin_os_log_format_buffer_size("Hello %*.*s World", precision, width, data);
- // CHECK: %[[V1:.*]] = load i8*, i8** %[[BUF_ADDR]], align 8
- // CHECK: %[[V2:.*]] = load i32, i32* %[[PRECISION_ADDR]], align 4
- // CHECK: %[[V3:.*]] = load i32, i32* %[[WIDTH_ADDR]], align 4
- // CHECK: %[[V4:.*]] = load i8*, i8** %[[DATA_ADDR]], align 8
- // CHECK: %[[V5:.*]] = ptrtoint i8* %[[V4]] to i64
- // CHECK: call void @__os_log_helper_1_2_3_4_0_4_16_8_32(i8* noundef %[[V1]], i32 noundef %[[V2]], i32 noundef %[[V3]], i64 noundef %[[V5]])
+ // CHECK: %[[V1:.*]] = load ptr, ptr %[[BUF_ADDR]], align 8
+ // CHECK: %[[V2:.*]] = load i32, ptr %[[PRECISION_ADDR]], align 4
+ // CHECK: %[[V3:.*]] = load i32, ptr %[[WIDTH_ADDR]], align 4
+ // CHECK: %[[V4:.*]] = load ptr, ptr %[[DATA_ADDR]], align 8
+ // CHECK: %[[V5:.*]] = ptrtoint ptr %[[V4]] to i64
+ // CHECK: call void @__os_log_helper_1_2_3_4_0_4_16_8_32(ptr noundef %[[V1]], i32 noundef %[[V2]], i32 noundef %[[V3]], i64 noundef %[[V5]])
__builtin_os_log_format(buf, "Hello %*.*s World", precision, width, data);
}
// CHECK-LABEL: define linkonce_odr hidden void @__os_log_helper_1_2_3_4_0_4_16_8_32
-// CHECK: (i8* noundef %[[BUFFER:.*]], i32 noundef %[[ARG0:.*]], i32 noundef %[[ARG1:.*]], i64 noundef %[[ARG2:.*]])
+// CHECK: (ptr noundef %[[BUFFER:.*]], i32 noundef %[[ARG0:.*]], i32 noundef %[[ARG1:.*]], i64 noundef %[[ARG2:.*]])
-// CHECK: %[[BUFFER_ADDR:.*]] = alloca i8*, align 8
+// CHECK: %[[BUFFER_ADDR:.*]] = alloca ptr, align 8
// CHECK: %[[ARG0_ADDR:.*]] = alloca i32, align 4
// CHECK: %[[ARG1_ADDR:.*]] = alloca i32, align 4
// CHECK: %[[ARG2_ADDR:.*]] = alloca i64, align 8
-// CHECK: store i8* %[[BUFFER]], i8** %[[BUFFER_ADDR]], align 8
-// CHECK: store i32 %[[ARG0]], i32* %[[ARG0_ADDR]], align 4
-// CHECK: store i32 %[[ARG1]], i32* %[[ARG1_ADDR]], align 4
-// CHECK: store i64 %[[ARG2]], i64* %[[ARG2_ADDR]], align 8
-// CHECK: %[[BUF:.*]] = load i8*, i8** %[[BUFFER_ADDR]], align 8
-// CHECK: %[[SUMMARY:.*]] = getelementptr i8, i8* %[[BUF]], i64 0
-// CHECK: store i8 2, i8* %[[SUMMARY]], align 1
-// CHECK: %[[NUMARGS:.*]] = getelementptr i8, i8* %[[BUF]], i64 1
-// CHECK: store i8 3, i8* %[[NUMARGS]], align 1
-// CHECK: %[[ARGDESCRIPTOR:.*]] = getelementptr i8, i8* %[[BUF]], i64 2
-// CHECK: store i8 0, i8* %[[ARGDESCRIPTOR]], align 1
-// CHECK: %[[ARGSIZE:.*]] = getelementptr i8, i8* %[[BUF]], i64 3
-// CHECK: store i8 4, i8* %[[ARGSIZE]], align 1
-// CHECK: %[[ARGDATA:.*]] = getelementptr i8, i8* %[[BUF]], i64 4
-// CHECK: %[[ARGDATACAST:.*]] = bitcast i8* %[[ARGDATA]] to i32*
-// CHECK: %[[V0:.*]] = load i32, i32* %[[ARG0_ADDR]], align 4
-// CHECK: store i32 %[[V0]], i32* %[[ARGDATACAST]], align 1
-// CHECK: %[[ARGDESCRIPTOR1:.*]] = getelementptr i8, i8* %[[BUF]], i64 8
-// CHECK: store i8 16, i8* %[[ARGDESCRIPTOR1]], align 1
-// CHECK: %[[ARGSIZE2:.*]] = getelementptr i8, i8* %[[BUF]], i64 9
-// CHECK: store i8 4, i8* %[[ARGSIZE2]], align 1
-// CHECK: %[[ARGDATA3:.*]] = getelementptr i8, i8* %[[BUF]], i64 10
-// CHECK: %[[ARGDATACAST4:.*]] = bitcast i8* %[[ARGDATA3]] to i32*
-// CHECK: %[[V1:.*]] = load i32, i32* %[[ARG1_ADDR]], align 4
-// CHECK: store i32 %[[V1]], i32* %[[ARGDATACAST4]], align 1
-// CHECK: %[[ARGDESCRIPTOR5:.*]] = getelementptr i8, i8* %[[BUF]], i64 14
-// CHECK: store i8 32, i8* %[[ARGDESCRIPTOR5]], align 1
-// CHECK: %[[ARGSIZE6:.*]] = getelementptr i8, i8* %[[BUF]], i64 15
-// CHECK: store i8 8, i8* %[[ARGSIZE6]], align 1
-// CHECK: %[[ARGDATA7:.*]] = getelementptr i8, i8* %[[BUF]], i64 16
-// CHECK: %[[ARGDATACAST8:.*]] = bitcast i8* %[[ARGDATA7]] to i64*
-// CHECK: %[[V2:.*]] = load i64, i64* %[[ARG2_ADDR]], align 8
-// CHECK: store i64 %[[V2]], i64* %[[ARGDATACAST8]], align 1
+// CHECK: store ptr %[[BUFFER]], ptr %[[BUFFER_ADDR]], align 8
+// CHECK: store i32 %[[ARG0]], ptr %[[ARG0_ADDR]], align 4
+// CHECK: store i32 %[[ARG1]], ptr %[[ARG1_ADDR]], align 4
+// CHECK: store i64 %[[ARG2]], ptr %[[ARG2_ADDR]], align 8
+// CHECK: %[[BUF:.*]] = load ptr, ptr %[[BUFFER_ADDR]], align 8
+// CHECK: %[[SUMMARY:.*]] = getelementptr i8, ptr %[[BUF]], i64 0
+// CHECK: store i8 2, ptr %[[SUMMARY]], align 1
+// CHECK: %[[NUMARGS:.*]] = getelementptr i8, ptr %[[BUF]], i64 1
+// CHECK: store i8 3, ptr %[[NUMARGS]], align 1
+// CHECK: %[[ARGDESCRIPTOR:.*]] = getelementptr i8, ptr %[[BUF]], i64 2
+// CHECK: store i8 0, ptr %[[ARGDESCRIPTOR]], align 1
+// CHECK: %[[ARGSIZE:.*]] = getelementptr i8, ptr %[[BUF]], i64 3
+// CHECK: store i8 4, ptr %[[ARGSIZE]], align 1
+// CHECK: %[[ARGDATA:.*]] = getelementptr i8, ptr %[[BUF]], i64 4
+// CHECK: %[[V0:.*]] = load i32, ptr %[[ARG0_ADDR]], align 4
+// CHECK: store i32 %[[V0]], ptr %[[ARGDATA]], align 1
+// CHECK: %[[ARGDESCRIPTOR1:.*]] = getelementptr i8, ptr %[[BUF]], i64 8
+// CHECK: store i8 16, ptr %[[ARGDESCRIPTOR1]], align 1
+// CHECK: %[[ARGSIZE2:.*]] = getelementptr i8, ptr %[[BUF]], i64 9
+// CHECK: store i8 4, ptr %[[ARGSIZE2]], align 1
+// CHECK: %[[ARGDATA3:.*]] = getelementptr i8, ptr %[[BUF]], i64 10
+// CHECK: %[[V1:.*]] = load i32, ptr %[[ARG1_ADDR]], align 4
+// CHECK: store i32 %[[V1]], ptr %[[ARGDATA3]], align 1
+// CHECK: %[[ARGDESCRIPTOR5:.*]] = getelementptr i8, ptr %[[BUF]], i64 14
+// CHECK: store i8 32, ptr %[[ARGDESCRIPTOR5]], align 1
+// CHECK: %[[ARGSIZE6:.*]] = getelementptr i8, ptr %[[BUF]], i64 15
+// CHECK: store i8 8, ptr %[[ARGSIZE6]], align 1
+// CHECK: %[[ARGDATA7:.*]] = getelementptr i8, ptr %[[BUF]], i64 16
+// CHECK: %[[V2:.*]] = load i64, ptr %[[ARG2_ADDR]], align 8
+// CHECK: store i64 %[[V2]], ptr %[[ARGDATA7]], align 1
// CHECK-LABEL: define{{.*}} void @test_builtin_os_log_invalid
-// CHECK: (i8* noundef %[[BUF:.*]], i32 noundef %[[DATA:.*]])
+// CHECK: (ptr noundef %[[BUF:.*]], i32 noundef %[[DATA:.*]])
void test_builtin_os_log_invalid(void *buf, int data) {
volatile int len;
- // CHECK: %[[BUF_ADDR:.*]] = alloca i8*, align 8
+ // CHECK: %[[BUF_ADDR:.*]] = alloca ptr, align 8
// CHECK: %[[DATA_ADDR:.*]] = alloca i32, align 4
// CHECK: %[[LEN:.*]] = alloca i32, align 4
- // CHECK: store i8* %[[BUF]], i8** %[[BUF_ADDR]], align 8
- // CHECK: store i32 %[[DATA]], i32* %[[DATA_ADDR]], align 4
+ // CHECK: store ptr %[[BUF]], ptr %[[BUF_ADDR]], align 8
+ // CHECK: store i32 %[[DATA]], ptr %[[DATA_ADDR]], align 4
- // CHECK: store volatile i32 8, i32* %[[LEN]], align 4
+ // CHECK: store volatile i32 8, ptr %[[LEN]], align 4
len = __builtin_os_log_format_buffer_size("invalid specifier %: %d even a trailing one%", data);
- // CHECK: %[[V1:.*]] = load i8*, i8** %[[BUF_ADDR]], align 8
- // CHECK: %[[V2:.*]] = load i32, i32* %[[DATA_ADDR]], align 4
- // CHECK: call void @__os_log_helper_1_0_1_4_0(i8* noundef %[[V1]], i32 noundef %[[V2]])
+ // CHECK: %[[V1:.*]] = load ptr, ptr %[[BUF_ADDR]], align 8
+ // CHECK: %[[V2:.*]] = load i32, ptr %[[DATA_ADDR]], align 4
+ // CHECK: call void @__os_log_helper_1_0_1_4_0(ptr noundef %[[V1]], i32 noundef %[[V2]])
__builtin_os_log_format(buf, "invalid specifier %: %d even a trailing one%", data);
}
// CHECK-LABEL: define linkonce_odr hidden void @__os_log_helper_1_0_1_4_0
-// CHECK: (i8* noundef %[[BUFFER:.*]], i32 noundef %[[ARG0:.*]])
+// CHECK: (ptr noundef %[[BUFFER:.*]], i32 noundef %[[ARG0:.*]])
-// CHECK: %[[BUFFER_ADDR:.*]] = alloca i8*, align 8
+// CHECK: %[[BUFFER_ADDR:.*]] = alloca ptr, align 8
// CHECK: %[[ARG0_ADDR:.*]] = alloca i32, align 4
-// CHECK: store i8* %[[BUFFER]], i8** %[[BUFFER_ADDR]], align 8
-// CHECK: store i32 %[[ARG0]], i32* %[[ARG0_ADDR]], align 4
-// CHECK: %[[BUF:.*]] = load i8*, i8** %[[BUFFER_ADDR]], align 8
-// CHECK: %[[SUMMARY:.*]] = getelementptr i8, i8* %[[BUF]], i64 0
-// CHECK: store i8 0, i8* %[[SUMMARY]], align 1
-// CHECK: %[[NUMARGS:.*]] = getelementptr i8, i8* %[[BUF]], i64 1
-// CHECK: store i8 1, i8* %[[NUMARGS]], align 1
-// CHECK: %[[ARGDESCRIPTOR:.*]] = getelementptr i8, i8* %[[BUF]], i64 2
-// CHECK: store i8 0, i8* %[[ARGDESCRIPTOR]], align 1
-// CHECK: %[[ARGSIZE:.*]] = getelementptr i8, i8* %[[BUF]], i64 3
-// CHECK: store i8 4, i8* %[[ARGSIZE]], align 1
-// CHECK: %[[ARGDATA:.*]] = getelementptr i8, i8* %[[BUF]], i64 4
-// CHECK: %[[ARGDATACAST:.*]] = bitcast i8* %[[ARGDATA]] to i32*
-// CHECK: %[[V0:.*]] = load i32, i32* %[[ARG0_ADDR]], align 4
-// CHECK: store i32 %[[V0]], i32* %[[ARGDATACAST]], align 1
+// CHECK: store ptr %[[BUFFER]], ptr %[[BUFFER_ADDR]], align 8
+// CHECK: store i32 %[[ARG0]], ptr %[[ARG0_ADDR]], align 4
+// CHECK: %[[BUF:.*]] = load ptr, ptr %[[BUFFER_ADDR]], align 8
+// CHECK: %[[SUMMARY:.*]] = getelementptr i8, ptr %[[BUF]], i64 0
+// CHECK: store i8 0, ptr %[[SUMMARY]], align 1
+// CHECK: %[[NUMARGS:.*]] = getelementptr i8, ptr %[[BUF]], i64 1
+// CHECK: store i8 1, ptr %[[NUMARGS]], align 1
+// CHECK: %[[ARGDESCRIPTOR:.*]] = getelementptr i8, ptr %[[BUF]], i64 2
+// CHECK: store i8 0, ptr %[[ARGDESCRIPTOR]], align 1
+// CHECK: %[[ARGSIZE:.*]] = getelementptr i8, ptr %[[BUF]], i64 3
+// CHECK: store i8 4, ptr %[[ARGSIZE]], align 1
+// CHECK: %[[ARGDATA:.*]] = getelementptr i8, ptr %[[BUF]], i64 4
+// CHECK: %[[V0:.*]] = load i32, ptr %[[ARG0_ADDR]], align 4
+// CHECK: store i32 %[[V0]], ptr %[[ARGDATA]], align 1
// CHECK-LABEL: define{{.*}} void @test_builtin_os_log_percent
-// CHECK: (i8* noundef %[[BUF:.*]], i8* noundef %[[DATA1:.*]], i8* noundef %[[DATA2:.*]])
+// CHECK: (ptr noundef %[[BUF:.*]], ptr noundef %[[DATA1:.*]], ptr noundef %[[DATA2:.*]])
// Check that the %% which does not consume any argument is correctly handled
void test_builtin_os_log_percent(void *buf, const char *data1, const char *data2) {
volatile int len;
- // CHECK: %[[BUF_ADDR:.*]] = alloca i8*, align 8
- // CHECK: %[[DATA1_ADDR:.*]] = alloca i8*, align 8
- // CHECK: %[[DATA2_ADDR:.*]] = alloca i8*, align 8
+ // CHECK: %[[BUF_ADDR:.*]] = alloca ptr, align 8
+ // CHECK: %[[DATA1_ADDR:.*]] = alloca ptr, align 8
+ // CHECK: %[[DATA2_ADDR:.*]] = alloca ptr, align 8
// CHECK: %[[LEN:.*]] = alloca i32, align 4
- // CHECK: store i8* %[[BUF]], i8** %[[BUF_ADDR]], align 8
- // CHECK: store i8* %[[DATA1]], i8** %[[DATA1_ADDR]], align 8
- // CHECK: store i8* %[[DATA2]], i8** %[[DATA2_ADDR]], align 8
- // CHECK: store volatile i32 22, i32* %[[LEN]], align 4
+ // CHECK: store ptr %[[BUF]], ptr %[[BUF_ADDR]], align 8
+ // CHECK: store ptr %[[DATA1]], ptr %[[DATA1_ADDR]], align 8
+ // CHECK: store ptr %[[DATA2]], ptr %[[DATA2_ADDR]], align 8
+ // CHECK: store volatile i32 22, ptr %[[LEN]], align 4
len = __builtin_os_log_format_buffer_size("%s %% %s", data1, data2);
- // CHECK: %[[V1:.*]] = load i8*, i8** %[[BUF_ADDR]], align 8
- // CHECK: %[[V2:.*]] = load i8*, i8** %[[DATA1_ADDR]], align 8
- // CHECK: %[[V3:.*]] = ptrtoint i8* %[[V2]] to i64
- // CHECK: %[[V4:.*]] = load i8*, i8** %[[DATA2_ADDR]], align 8
- // CHECK: %[[V5:.*]] = ptrtoint i8* %[[V4]] to i64
- // CHECK: call void @__os_log_helper_1_2_2_8_32_8_32(i8* noundef %[[V1]], i64 noundef %[[V3]], i64 noundef %[[V5]])
+ // CHECK: %[[V1:.*]] = load ptr, ptr %[[BUF_ADDR]], align 8
+ // CHECK: %[[V2:.*]] = load ptr, ptr %[[DATA1_ADDR]], align 8
+ // CHECK: %[[V3:.*]] = ptrtoint ptr %[[V2]] to i64
+ // CHECK: %[[V4:.*]] = load ptr, ptr %[[DATA2_ADDR]], align 8
+ // CHECK: %[[V5:.*]] = ptrtoint ptr %[[V4]] to i64
+ // CHECK: call void @__os_log_helper_1_2_2_8_32_8_32(ptr noundef %[[V1]], i64 noundef %[[V3]], i64 noundef %[[V5]])
__builtin_os_log_format(buf, "%s %% %s", data1, data2);
}
// CHECK-LABEL: define linkonce_odr hidden void @__os_log_helper_1_2_2_8_32_8_32
-// CHECK: (i8* noundef %[[BUFFER:.*]], i64 noundef %[[ARG0:.*]], i64 noundef %[[ARG1:.*]])
+// CHECK: (ptr noundef %[[BUFFER:.*]], i64 noundef %[[ARG0:.*]], i64 noundef %[[ARG1:.*]])
-// CHECK: %[[BUFFER_ADDR:.*]] = alloca i8*, align 8
+// CHECK: %[[BUFFER_ADDR:.*]] = alloca ptr, align 8
// CHECK: %[[ARG0_ADDR:.*]] = alloca i64, align 8
// CHECK: %[[ARG1_ADDR:.*]] = alloca i64, align 8
-// CHECK: store i8* %[[BUFFER]], i8** %[[BUFFER_ADDR]], align 8
-// CHECK: store i64 %[[ARG0]], i64* %[[ARG0_ADDR]], align 8
-// CHECK: store i64 %[[ARG1]], i64* %[[ARG1_ADDR]], align 8
-// CHECK: %[[BUF:.*]] = load i8*, i8** %[[BUFFER_ADDR]], align 8
-// CHECK: %[[SUMMARY:.*]] = getelementptr i8, i8* %[[BUF]], i64 0
-// CHECK: store i8 2, i8* %[[SUMMARY]], align 1
-// CHECK: %[[NUMARGS:.*]] = getelementptr i8, i8* %[[BUF]], i64 1
-// CHECK: store i8 2, i8* %[[NUMARGS]], align 1
-// CHECK: %[[ARGDESCRIPTOR:.*]] = getelementptr i8, i8* %[[BUF]], i64 2
-// CHECK: store i8 32, i8* %[[ARGDESCRIPTOR]], align 1
-// CHECK: %[[ARGSIZE:.*]] = getelementptr i8, i8* %[[BUF]], i64 3
-// CHECK: store i8 8, i8* %[[ARGSIZE]], align 1
-// CHECK: %[[ARGDATA:.*]] = getelementptr i8, i8* %[[BUF]], i64 4
-// CHECK: %[[ARGDATACAST:.*]] = bitcast i8* %[[ARGDATA]] to i64*
-// CHECK: %[[V0:.*]] = load i64, i64* %[[ARG0_ADDR]], align 8
-// CHECK: store i64 %[[V0]], i64* %[[ARGDATACAST]], align 1
-// CHECK: %[[ARGDESCRIPTOR1:.*]] = getelementptr i8, i8* %[[BUF]], i64 12
-// CHECK: store i8 32, i8* %[[ARGDESCRIPTOR1]], align 1
-// CHECK: %[[ARGSIZE2:.*]] = getelementptr i8, i8* %[[BUF]], i64 13
-// CHECK: store i8 8, i8* %[[ARGSIZE2]], align 1
-// CHECK: %[[ARGDATA3:.*]] = getelementptr i8, i8* %[[BUF]], i64 14
-// CHECK: %[[ARGDATACAST4:.*]] = bitcast i8* %[[ARGDATA3]] to i64*
-// CHECK: %[[V1:.*]] = load i64, i64* %[[ARG1_ADDR]], align 8
-// CHECK: store i64 %[[V1]], i64* %[[ARGDATACAST4]], align 1
+// CHECK: store ptr %[[BUFFER]], ptr %[[BUFFER_ADDR]], align 8
+// CHECK: store i64 %[[ARG0]], ptr %[[ARG0_ADDR]], align 8
+// CHECK: store i64 %[[ARG1]], ptr %[[ARG1_ADDR]], align 8
+// CHECK: %[[BUF:.*]] = load ptr, ptr %[[BUFFER_ADDR]], align 8
+// CHECK: %[[SUMMARY:.*]] = getelementptr i8, ptr %[[BUF]], i64 0
+// CHECK: store i8 2, ptr %[[SUMMARY]], align 1
+// CHECK: %[[NUMARGS:.*]] = getelementptr i8, ptr %[[BUF]], i64 1
+// CHECK: store i8 2, ptr %[[NUMARGS]], align 1
+// CHECK: %[[ARGDESCRIPTOR:.*]] = getelementptr i8, ptr %[[BUF]], i64 2
+// CHECK: store i8 32, ptr %[[ARGDESCRIPTOR]], align 1
+// CHECK: %[[ARGSIZE:.*]] = getelementptr i8, ptr %[[BUF]], i64 3
+// CHECK: store i8 8, ptr %[[ARGSIZE]], align 1
+// CHECK: %[[ARGDATA:.*]] = getelementptr i8, ptr %[[BUF]], i64 4
+// CHECK: %[[V0:.*]] = load i64, ptr %[[ARG0_ADDR]], align 8
+// CHECK: store i64 %[[V0]], ptr %[[ARGDATA]], align 1
+// CHECK: %[[ARGDESCRIPTOR1:.*]] = getelementptr i8, ptr %[[BUF]], i64 12
+// CHECK: store i8 32, ptr %[[ARGDESCRIPTOR1]], align 1
+// CHECK: %[[ARGSIZE2:.*]] = getelementptr i8, ptr %[[BUF]], i64 13
+// CHECK: store i8 8, ptr %[[ARGSIZE2]], align 1
+// CHECK: %[[ARGDATA3:.*]] = getelementptr i8, ptr %[[BUF]], i64 14
+// CHECK: %[[V1:.*]] = load i64, ptr %[[ARG1_ADDR]], align 8
+// CHECK: store i64 %[[V1]], ptr %[[ARGDATA3]], align 1
// Check that the following two functions call the same helper function.
@@ -840,8 +829,8 @@ void test_builtin_os_log_merge_helper1(void *buf, unsigned u, long long ll) {
void test_builtin_os_log_errno(void) {
// CHECK-NOT: @stacksave
// CHECK: %[[BUF:.*]] = alloca [4 x i8], align 1
- // CHECK: %[[DECAY:.*]] = getelementptr inbounds [4 x i8], [4 x i8]* %[[BUF]], i64 0, i64 0
- // CHECK: call void @__os_log_helper_1_2_1_0_96(i8* noundef %[[DECAY]])
+ // CHECK: %[[DECAY:.*]] = getelementptr inbounds [4 x i8], ptr %[[BUF]], i64 0, i64 0
+ // CHECK: call void @__os_log_helper_1_2_1_0_96(ptr noundef %[[DECAY]])
// CHECK-NOT: @stackrestore
char buf[__builtin_os_log_format_buffer_size("%m")];
@@ -849,70 +838,67 @@ void test_builtin_os_log_errno(void) {
}
// CHECK-LABEL: define linkonce_odr hidden void @__os_log_helper_1_2_1_0_96
-// CHECK: (i8* noundef %[[BUFFER:.*]])
-
-// CHECK: %[[BUFFER_ADDR:.*]] = alloca i8*, align 8
-// CHECK: store i8* %[[BUFFER]], i8** %[[BUFFER_ADDR]], align 8
-// CHECK: %[[BUF:.*]] = load i8*, i8** %[[BUFFER_ADDR]], align 8
-// CHECK: %[[SUMMARY:.*]] = getelementptr i8, i8* %[[BUF]], i64 0
-// CHECK: store i8 2, i8* %[[SUMMARY]], align 1
-// CHECK: %[[NUMARGS:.*]] = getelementptr i8, i8* %[[BUF]], i64 1
-// CHECK: store i8 1, i8* %[[NUMARGS]], align 1
-// CHECK: %[[ARGDESCRIPTOR:.*]] = getelementptr i8, i8* %[[BUF]], i64 2
-// CHECK: store i8 96, i8* %[[ARGDESCRIPTOR]], align 1
-// CHECK: %[[ARGSIZE:.*]] = getelementptr i8, i8* %[[BUF]], i64 3
-// CHECK: store i8 0, i8* %[[ARGSIZE]], align 1
+// CHECK: (ptr noundef %[[BUFFER:.*]])
+
+// CHECK: %[[BUFFER_ADDR:.*]] = alloca ptr, align 8
+// CHECK: store ptr %[[BUFFER]], ptr %[[BUFFER_ADDR]], align 8
+// CHECK: %[[BUF:.*]] = load ptr, ptr %[[BUFFER_ADDR]], align 8
+// CHECK: %[[SUMMARY:.*]] = getelementptr i8, ptr %[[BUF]], i64 0
+// CHECK: store i8 2, ptr %[[SUMMARY]], align 1
+// CHECK: %[[NUMARGS:.*]] = getelementptr i8, ptr %[[BUF]], i64 1
+// CHECK: store i8 1, ptr %[[NUMARGS]], align 1
+// CHECK: %[[ARGDESCRIPTOR:.*]] = getelementptr i8, ptr %[[BUF]], i64 2
+// CHECK: store i8 96, ptr %[[ARGDESCRIPTOR]], align 1
+// CHECK: %[[ARGSIZE:.*]] = getelementptr i8, ptr %[[BUF]], i64 3
+// CHECK: store i8 0, ptr %[[ARGSIZE]], align 1
// CHECK-NEXT: ret void
// CHECK-LABEL: define{{.*}} void @test_builtin_os_log_long_double
-// CHECK: (i8* noundef %[[BUF:.*]], x86_fp80 noundef %[[LD:.*]])
+// CHECK: (ptr noundef %[[BUF:.*]], x86_fp80 noundef %[[LD:.*]])
void test_builtin_os_log_long_double(void *buf, long double ld) {
- // CHECK: %[[BUF_ADDR:.*]] = alloca i8*, align 8
+ // CHECK: %[[BUF_ADDR:.*]] = alloca ptr, align 8
// CHECK: %[[LD_ADDR:.*]] = alloca x86_fp80, align 16
// CHECK: %[[COERCE:.*]] = alloca i128, align 16
- // CHECK: store i8* %[[BUF]], i8** %[[BUF_ADDR]], align 8
- // CHECK: store x86_fp80 %[[LD]], x86_fp80* %[[LD_ADDR]], align 16
- // CHECK: %[[V0:.*]] = load i8*, i8** %[[BUF_ADDR]], align 8
- // CHECK: %[[V1:.*]] = load x86_fp80, x86_fp80* %[[LD_ADDR]], align 16
+ // CHECK: store ptr %[[BUF]], ptr %[[BUF_ADDR]], align 8
+ // CHECK: store x86_fp80 %[[LD]], ptr %[[LD_ADDR]], align 16
+ // CHECK: %[[V0:.*]] = load ptr, ptr %[[BUF_ADDR]], align 8
+ // CHECK: %[[V1:.*]] = load x86_fp80, ptr %[[LD_ADDR]], align 16
// CHECK: %[[V2:.*]] = bitcast x86_fp80 %[[V1]] to i80
// CHECK: %[[V3:.*]] = zext i80 %[[V2]] to i128
- // CHECK: store i128 %[[V3]], i128* %[[COERCE]], align 16
- // CHECK: %[[V4:.*]] = bitcast i128* %[[COERCE]] to { i64, i64 }*
- // CHECK: %[[V5:.*]] = getelementptr inbounds { i64, i64 }, { i64, i64 }* %[[V4]], i32 0, i32 0
- // CHECK: %[[V6:.*]] = load i64, i64* %[[V5]], align 16
- // CHECK: %[[V7:.*]] = getelementptr inbounds { i64, i64 }, { i64, i64 }* %[[V4]], i32 0, i32 1
- // CHECK: %[[V8:.*]] = load i64, i64* %[[V7]], align 8
- // CHECK: call void @__os_log_helper_1_0_1_16_0(i8* noundef %[[V0]], i64 noundef %[[V6]], i64 noundef %[[V8]])
+ // CHECK: store i128 %[[V3]], ptr %[[COERCE]], align 16
+ // CHECK: %[[V5:.*]] = getelementptr inbounds { i64, i64 }, ptr %[[COERCE]], i32 0, i32 0
+ // CHECK: %[[V6:.*]] = load i64, ptr %[[V5]], align 16
+ // CHECK: %[[V7:.*]] = getelementptr inbounds { i64, i64 }, ptr %[[COERCE]], i32 0, i32 1
+ // CHECK: %[[V8:.*]] = load i64, ptr %[[V7]], align 8
+ // CHECK: call void @__os_log_helper_1_0_1_16_0(ptr noundef %[[V0]], i64 noundef %[[V6]], i64 noundef %[[V8]])
__builtin_os_log_format(buf, "%Lf", ld);
}
// CHECK-LABEL: define linkonce_odr hidden void @__os_log_helper_1_0_1_16_0
-// CHECK: (i8* noundef %[[BUFFER:.*]], i64 noundef %[[ARG0_COERCE0:.*]], i64 noundef %[[ARG0_COERCE1:.*]])
+// CHECK: (ptr noundef %[[BUFFER:.*]], i64 noundef %[[ARG0_COERCE0:.*]], i64 noundef %[[ARG0_COERCE1:.*]])
// CHECK: %[[ARG0:.*]] = alloca i128, align 16
-// CHECK: %[[BUFFER_ADDR:.*]] = alloca i8*, align 8
+// CHECK: %[[BUFFER_ADDR:.*]] = alloca ptr, align 8
// CHECK: %[[ARG0_ADDR:.*]] = alloca i128, align 16
-// CHECK: %[[V0:.*]] = bitcast i128* %[[ARG0]] to { i64, i64 }*
-// CHECK: %[[V1:.*]] = getelementptr inbounds { i64, i64 }, { i64, i64 }* %[[V0]], i32 0, i32 0
-// CHECK: store i64 %[[ARG0_COERCE0]], i64* %[[V1]], align 16
-// CHECK: %[[V2:.*]] = getelementptr inbounds { i64, i64 }, { i64, i64 }* %[[V0]], i32 0, i32 1
-// CHECK: store i64 %[[ARG0_COERCE1]], i64* %[[V2]], align 8
-// CHECK: %[[ARG01:.*]] = load i128, i128* %[[ARG0]], align 16
-// CHECK: store i8* %[[BUFFER]], i8** %[[BUFFER_ADDR]], align 8
-// CHECK: store i128 %[[ARG01]], i128* %[[ARG0_ADDR]], align 16
-// CHECK: %[[BUF:.*]] = load i8*, i8** %[[BUFFER_ADDR]], align 8
-// CHECK: %[[SUMMARY:.*]] = getelementptr i8, i8* %[[BUF]], i64 0
-// CHECK: store i8 0, i8* %[[SUMMARY]], align 1
-// CHECK: %[[NUMARGS:.*]] = getelementptr i8, i8* %[[BUF]], i64 1
-// CHECK: store i8 1, i8* %[[NUMARGS]], align 1
-// CHECK: %[[ARGDESCRIPTOR:.*]] = getelementptr i8, i8* %[[BUF]], i64 2
-// CHECK: store i8 0, i8* %[[ARGDESCRIPTOR]], align 1
-// CHECK: %[[ARGSIZE:.*]] = getelementptr i8, i8* %[[BUF]], i64 3
-// CHECK: store i8 16, i8* %[[ARGSIZE]], align 1
-// CHECK: %[[ARGDATA:.*]] = getelementptr i8, i8* %[[BUF]], i64 4
-// CHECK: %[[ARGDATACAST:.*]] = bitcast i8* %[[ARGDATA]] to i128*
-// CHECK: %[[V3:.*]] = load i128, i128* %[[ARG0_ADDR]], align 16
-// CHECK: store i128 %[[V3]], i128* %[[ARGDATACAST]], align 1
+// CHECK: %[[V1:.*]] = getelementptr inbounds { i64, i64 }, ptr %[[ARG0]], i32 0, i32 0
+// CHECK: store i64 %[[ARG0_COERCE0]], ptr %[[V1]], align 16
+// CHECK: %[[V2:.*]] = getelementptr inbounds { i64, i64 }, ptr %[[ARG0]], i32 0, i32 1
+// CHECK: store i64 %[[ARG0_COERCE1]], ptr %[[V2]], align 8
+// CHECK: %[[ARG01:.*]] = load i128, ptr %[[ARG0]], align 16
+// CHECK: store ptr %[[BUFFER]], ptr %[[BUFFER_ADDR]], align 8
+// CHECK: store i128 %[[ARG01]], ptr %[[ARG0_ADDR]], align 16
+// CHECK: %[[BUF:.*]] = load ptr, ptr %[[BUFFER_ADDR]], align 8
+// CHECK: %[[SUMMARY:.*]] = getelementptr i8, ptr %[[BUF]], i64 0
+// CHECK: store i8 0, ptr %[[SUMMARY]], align 1
+// CHECK: %[[NUMARGS:.*]] = getelementptr i8, ptr %[[BUF]], i64 1
+// CHECK: store i8 1, ptr %[[NUMARGS]], align 1
+// CHECK: %[[ARGDESCRIPTOR:.*]] = getelementptr i8, ptr %[[BUF]], i64 2
+// CHECK: store i8 0, ptr %[[ARGDESCRIPTOR]], align 1
+// CHECK: %[[ARGSIZE:.*]] = getelementptr i8, ptr %[[BUF]], i64 3
+// CHECK: store i8 16, ptr %[[ARGSIZE]], align 1
+// CHECK: %[[ARGDATA:.*]] = getelementptr i8, ptr %[[BUF]], i64 4
+// CHECK: %[[V3:.*]] = load i128, ptr %[[ARG0_ADDR]], align 16
+// CHECK: store i128 %[[V3]], ptr %[[ARGDATA]], align 1
#endif
More information about the cfe-commits
mailing list