Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / ptrauth-function.c
blobeea3f7ed73747f00e8a6d36d5f1a8f8c4310c86f
1 // RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm %s -o - | FileCheck -check-prefix=CHECK %s
2 // RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -emit-llvm %s -o - | FileCheck -check-prefix=CHECK %s
4 void test_call();
6 // CHECK: define {{(dso_local )?}}void @test_direct_call()
7 void test_direct_call() {
8 // CHECK: call void @test_call(){{$}}
9 test_call();
12 // CHECK: define {{(dso_local )?}}void @test_indirect_call(ptr noundef %[[FP:.*]])
13 void test_indirect_call(void (*fp(void))) {
14 // CHECK: %[[FP_ADDR:.*]] = alloca ptr, align 8
15 // CHECK: store ptr %[[FP]], ptr %[[FP_ADDR]], align 8
16 // CHECK: %[[V0:.*]] = load ptr, ptr %[[FP_ADDR]], align 8
17 // CHECK: %[[CALL:.*]] = call ptr %[[V0]]() [ "ptrauth"(i32 0, i64 0) ]
18 fp();
21 void abort();
22 // CHECK: define {{(dso_local )?}}void @test_direct_builtin_call()
23 void test_direct_builtin_call() {
24 // CHECK: call void @abort() {{#[0-9]+$}}
25 abort();
28 // CHECK-LABEL: define {{(dso_local )?}}void @test_memcpy_inline(
29 // CHECK-NOT: call{{.*}}memcpy
31 extern inline __attribute__((__always_inline__))
32 void *memcpy(void *d, const void *s, unsigned long) {
33 return 0;
36 void test_memcpy_inline(char *d, char *s) {
37 memcpy(d, s, 4);