Upon further investigation and discussion, this is actually the opposite direction from what we should be taking, and this direction wouldn't solve the motivational problem anyway. Additionally, some more (polly) tests have escaped being updated. So, let's just take a step back here. This reverts commit f3190dedeef9da2109ea57e4cb372f295ff53b88. This reverts commit 749581d21f2b3f53e4fca4eb8728c942d646893b. This reverts commit f3df87d57e096143670e0fd396e81d43393a2dd2. This reverts commit ab1dbcecd6f0969976fafd62af34730436ad5944.
37 lines
1.7 KiB
C++
37 lines
1.7 KiB
C++
// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-mfcall -fsanitize-trap=cfi-mfcall -fvisibility hidden -emit-llvm -o - %s | FileCheck %s
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-mfcall -fsanitize-trap=cfi-mfcall -fvisibility default -emit-llvm -o - %s | FileCheck --check-prefix=DEFAULT %s
|
|
// With -fwhole-program-vtables we should get the member function pointer type
|
|
// test, even without hidden visibility.
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-linux -fwhole-program-vtables -emit-llvm -o - %s | FileCheck %s --check-prefix=WPV
|
|
|
|
struct B1 {};
|
|
struct B2 {};
|
|
struct B3 : B2 {};
|
|
struct S : B1, B3 {};
|
|
|
|
// DEFAULT-NOT: llvm.type.test
|
|
|
|
void f(S *s, void (S::*p)()) {
|
|
// WPV: [[OFFSET:%.*]] = sub i64 {{.*}}, 1
|
|
// WPV: [[VFPTR:%.*]] = getelementptr i8, i8* %{{.*}}, i64 [[OFFSET]]
|
|
// WPV: [[TT:%.*]] = call i1 @llvm.type.test(i8* [[VFPTR]], metadata !"_ZTSM1SFvvE.virtual")
|
|
// CHECK: [[OFFSET:%.*]] = sub i64 {{.*}}, 1
|
|
// CHECK: [[VFPTR:%.*]] = getelementptr i8, i8* %{{.*}}, i64 [[OFFSET]]
|
|
// CHECK: [[TT:%.*]] = call i1 @llvm.type.test(i8* [[VFPTR]], metadata !"_ZTSM1SFvvE.virtual")
|
|
// CHECK: br i1 [[TT]], label {{.*}}, label %[[TRAP1:[^,]*]]
|
|
|
|
// CHECK: [[TRAP1]]:
|
|
// CHECK-NEXT: llvm.ubsantrap
|
|
|
|
// CHECK: [[NVFPTR:%.*]] = bitcast void (%struct.S*)* {{.*}} to i8*
|
|
// CHECK: [[TT1:%.*]] = call i1 @llvm.type.test(i8* [[NVFPTR]], metadata !"_ZTSM2B1FvvE")
|
|
// CHECK: [[OR1:%.*]] = or i1 false, [[TT1]]
|
|
// CHECK: [[TT2:%.*]] = call i1 @llvm.type.test(i8* [[NVFPTR]], metadata !"_ZTSM2B2FvvE")
|
|
// CHECK: [[OR2:%.*]] = or i1 [[OR1]], [[TT2]]
|
|
// CHECK: br i1 [[OR2]], label {{.*}}, label %[[TRAP2:[^,]*]]
|
|
|
|
// CHECK: [[TRAP2]]:
|
|
// CHECK-NEXT: llvm.ubsantrap
|
|
(s->*p)();
|
|
}
|