1
- // RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -o - %s | FileCheck -check-prefixes=CHECK,NODEBUG %s
2
- // RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -debug-info-kind=limited -o - %s | FileCheck -check-prefixes=CHECK %s
3
- // RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 1 -o - %s | FileCheck %s -check-prefix=STACK-PROT
4
- // RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 2 -o - %s | FileCheck %s -check-prefix=STACK-PROT
5
- // RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 3 -o - %s | FileCheck %s -check-prefix=STACK-PROT
1
+ // RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -o - %s | FileCheck -check-prefixes=CHECK,NODEBUG,DARWIN %s
2
+ // RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -debug-info-kind=limited -o - %s | FileCheck -check-prefixes=CHECK,DARWIN %s
3
+ // RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 1 -o - %s | FileCheck %s -check-prefix=STACK-PROT
4
+ // RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 2 -o - %s | FileCheck %s -check-prefix=STACK-PROT
5
+ // RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 3 -o - %s | FileCheck %s -check-prefix=STACK-PROT
6
+
7
+ // RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -o - %s | FileCheck -check-prefixes=CHECK,NODEBUG,ELF %s
8
+ // RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -debug-info-kind=limited -o - %s | FileCheck -check-prefixes=CHECK,ELF %s
9
+ // RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 1 -o - %s | FileCheck %s -check-prefix=STACK-PROT
10
+ // RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 2 -o - %s | FileCheck %s -check-prefix=STACK-PROT
11
+ // RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 3 -o - %s | FileCheck %s -check-prefix=STACK-PROT
6
12
7
13
8
14
// CHECK: @gmethod0 = global { i64, i64 } { i64 ptrtoint (ptr ptrauth (ptr @_ZN5Base011nonvirtual0Ev, i32 0, i64 [[TYPEDISC1:35591]]) to i64), i64 0 }, align 8
@@ -78,9 +84,9 @@ struct Class0 {
78
84
MethodTy1 m0;
79
85
};
80
86
81
- // CHECK: define void @_ZN5Base08virtual1Ev(
87
+ // CHECK: define{{.*}} void @_ZN5Base08virtual1Ev(
82
88
83
- // CHECK: define void @_Z5test0v()
89
+ // CHECK: define{{.*}} void @_Z5test0v()
84
90
// CHECK: %[[METHOD0:.*]] = alloca { i64, i64 }, align 8
85
91
// CHECK-NEXT: %[[VARMETHOD1:.*]] = alloca { i64, i64 }, align 8
86
92
// CHECK-NEXT: %[[METHOD2:.*]] = alloca { i64, i64 }, align 8
@@ -246,7 +252,7 @@ void test0() {
246
252
method7 = &Derived1::virtual1;
247
253
}
248
254
249
- // CHECK: define void @_Z5test1P5Base0MS_FvvE(ptr noundef %[[A0:.*]], [2 x i64] %[[A1_COERCE:.*]])
255
+ // CHECK: define{{.*}} void @_Z5test1P5Base0MS_FvvE(ptr noundef %[[A0:.*]], [2 x i64] %[[A1_COERCE:.*]])
250
256
// CHECK: %[[A1:.*]] = alloca { i64, i64 }, align 8
251
257
// CHECK: %[[A0_ADDR:.*]] = alloca ptr, align 8
252
258
// CHECK: %[[A1_ADDR:.*]] = alloca { i64, i64 }, align 8
@@ -264,15 +270,16 @@ void test0() {
264
270
// CHECK: %[[MEMPTR_ISVIRTUAL:.*]] = icmp ne i64 %[[V5]], 0
265
271
// CHECK: br i1 %[[MEMPTR_ISVIRTUAL]]
266
272
267
- // CHECK: %[[VTABLE:.*]] = load ptr, ptr %[[V4]], align 8
268
- // CHECK: %[[V7:.*]] = ptrtoint ptr %[[VTABLE]] to i64
269
- // CHECK: %[[V8:.*]] = call i64 @llvm.ptrauth.auth(i64 %[[V7]], i32 2, i64 0)
270
- // CHECK: %[[V9:.*]] = inttoptr i64 %[[V8]] to ptr
271
- // CHECK: %[[V10:.*]] = trunc i64 %[[MEMPTR_PTR]] to i32
272
- // CHECK: %[[V11:.*]] = zext i32 %[[V10]] to i64
273
- // CHECK: %[[V12:.*]] = getelementptr i8, ptr %[[V9]], i64 %[[V11]]
274
- // CHECK: %[[MEMPTR_VIRTUALFN:.*]] = load ptr, ptr %[[V12]], align 8
275
- // CHECK: br
273
+ // CHECK: %[[VTABLE:.*]] = load ptr, ptr %[[V4]], align 8
274
+ // CHECK: %[[V7:.*]] = ptrtoint ptr %[[VTABLE]] to i64
275
+ // CHECK: %[[V8:.*]] = call i64 @llvm.ptrauth.auth(i64 %[[V7]], i32 2, i64 0)
276
+ // CHECK: %[[V9:.*]] = inttoptr i64 %[[V8]] to ptr
277
+ // DARWIN: %[[V10:.*]] = trunc i64 %[[MEMPTR_PTR]] to i32
278
+ // DARWIN: %[[V11:.*]] = zext i32 %[[V10]] to i64
279
+ // DARWIN: %[[V12:.*]] = getelementptr i8, ptr %[[V9]], i64 %[[V11]]
280
+ // ELF: %[[V12:.*]] = getelementptr i8, ptr %[[V9]], i64 %[[MEMPTR_PTR]]
281
+ // CHECK: %[[MEMPTR_VIRTUALFN:.*]] = load ptr, ptr %[[V12]], align 8
282
+ // CHECK: br
276
283
277
284
// CHECK: %[[MEMPTR_NONVIRTUALFN:.*]] = inttoptr i64 %[[MEMPTR_PTR]] to ptr
278
285
// CHECK: br
@@ -286,7 +293,7 @@ void test1(Base0 *a0, MethodTy0 a1) {
286
293
(a0->*a1)();
287
294
}
288
295
289
- // CHECK: define void @_Z15testConversion0M5Base0FvvEM8Derived0FvvE([2 x i64] %[[METHOD0_COERCE:.*]], [2 x i64] %[[METHOD1_COERCE:.*]])
296
+ // CHECK: define{{.*}} void @_Z15testConversion0M5Base0FvvEM8Derived0FvvE([2 x i64] %[[METHOD0_COERCE:.*]], [2 x i64] %[[METHOD1_COERCE:.*]])
290
297
// CHECK: %[[METHOD0:.*]] = alloca { i64, i64 }, align 8
291
298
// CHECK: %[[METHOD1:.*]] = alloca { i64, i64 }, align 8
292
299
// CHECK: %[[METHOD0_ADDR:.*]] = alloca { i64, i64 }, align 8
@@ -326,21 +333,21 @@ void testConversion0(MethodTy0 method0, MethodTy1 method1) {
326
333
method1 = method0;
327
334
}
328
335
329
- // CHECK: define void @_Z15testConversion1M5Base0FvvE(
336
+ // CHECK: define{{.*}} void @_Z15testConversion1M5Base0FvvE(
330
337
// CHECK: call i64 @llvm.ptrauth.resign(i64 %{{.*}}, i32 0, i64 [[TYPEDISC0]], i32 0, i64 [[TYPEDISC1]])
331
338
332
339
void testConversion1 (MethodTy0 method0) {
333
340
MethodTy1 method1 = reinterpret_cast <MethodTy1>(method0);
334
341
}
335
342
336
- // CHECK: define void @_Z15testConversion2M8Derived0FvvE(
343
+ // CHECK: define{{.*}} void @_Z15testConversion2M8Derived0FvvE(
337
344
// CHECK: call i64 @llvm.ptrauth.resign(i64 %{{.*}}, i32 0, i64 [[TYPEDISC1]], i32 0, i64 [[TYPEDISC0]])
338
345
339
346
void testConversion2 (MethodTy1 method1) {
340
347
MethodTy0 method0 = static_cast <MethodTy0>(method1);
341
348
}
342
349
343
- // CHECK: define void @_Z15testConversion3M8Derived0FvvE(
350
+ // CHECK: define{{.*}} void @_Z15testConversion3M8Derived0FvvE(
344
351
// CHECK: call i64 @llvm.ptrauth.resign(i64 %{{.*}}, i32 0, i64 [[TYPEDISC1]], i32 0, i64 [[TYPEDISC0]])
345
352
346
353
void testConversion3 (MethodTy1 method1) {
@@ -350,7 +357,7 @@ void testConversion3(MethodTy1 method1) {
350
357
// No need to call @llvm.ptrauth.resign if the source member function
351
358
// pointer is a constant.
352
359
353
- // CHECK: define void @_Z15testConversion4v(
360
+ // CHECK: define{{.*}} void @_Z15testConversion4v(
354
361
// CHECK: %[[METHOD0:.*]] = alloca { i64, i64 }, align 8
355
362
// CHECK: store { i64, i64 } { i64 ptrtoint (ptr ptrauth (ptr @_ZN5Base08virtual1Ev_vfpthunk_, i32 0, i64 [[TYPEDISC0]]) to i64), i64 0 }, ptr %[[METHOD0]], align 8
356
363
// CHECK: ret void
@@ -396,7 +403,7 @@ MethodTy1 gmethod0 = reinterpret_cast<MethodTy1>(&Base0::nonvirtual0);
396
403
MethodTy0 gmethod1 = reinterpret_cast <MethodTy0>(&Derived0::nonvirtual5);
397
404
MethodTy0 gmethod2 = reinterpret_cast <MethodTy0>(&Derived0::virtual1);
398
405
399
- // CHECK-LABEL: define void @_Z13testArrayInitv()
406
+ // CHECK-LABEL: define{{.*}} void @_Z13testArrayInitv()
400
407
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %p0, ptr align 8 @__const._Z13testArrayInitv.p0, i64 16, i1 false)
401
408
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %p1, ptr align 8 @__const._Z13testArrayInitv.p1, i64 16, i1 false)
402
409
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %c0, ptr align 8 @__const._Z13testArrayInitv.c0, i64 16, i1 false)
@@ -424,7 +431,7 @@ void testArrayInit() {
424
431
// STACK-PROT-NOT: sspreq
425
432
// STACK-PROT-NEXT: attributes
426
433
427
- // CHECK: define void @_Z15testConvertNullv(
434
+ // CHECK: define{{.*}} void @_Z15testConvertNullv(
428
435
// CHECK: %[[T:.*]] = alloca { i64, i64 },
429
436
// store { i64, i64 } zeroinitializer, { i64, i64 }* %[[T]],
430
437
0 commit comments