Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / cfi-cross-dso.cpp
blob26e7e1e673da7c9b2402837579b65d407b47bc07
1 // RUN: %clang_cc1 -flto -triple x86_64-unknown-linux -fsanitize=cfi-vcall -fsanitize-cfi-cross-dso -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=ITANIUM %s
2 // RUN: %clang_cc1 -flto -triple x86_64-pc-windows-msvc -fsanitize=cfi-vcall -fsanitize-cfi-cross-dso -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=MS %s
4 struct A {
5 A();
6 virtual void f();
7 };
9 A::A() {}
10 void A::f() {}
12 void caller(A* a) {
13 a->f();
16 namespace {
17 struct B {
18 virtual void f();
21 void B::f() {}
22 } // namespace
24 void g() {
25 B b;
26 b.f();
29 // MS: @[[B_VTABLE:.*]] = private unnamed_addr constant { [2 x ptr] } {{.*}}@"??_R4B@?A0x{{[^@]*}}@@6B@"{{.*}}@"?f@B@?A0x{{[^@]*}}@@UEAAXXZ"
31 // CHECK-LABEL: caller
32 // CHECK: %[[A:.*]] = load ptr, ptr
33 // CHECK: %[[VT:.*]] = load ptr, ptr %[[A]]
34 // ITANIUM: %[[TEST:.*]] = call i1 @llvm.type.test(ptr %[[VT]], metadata !"_ZTS1A"), !nosanitize
35 // MS: %[[TEST:.*]] = call i1 @llvm.type.test(ptr %[[VT]], metadata !"?AUA@@"), !nosanitize
36 // CHECK: br i1 %[[TEST]], label %[[CONT:.*]], label %[[SLOW:.*]], {{.*}} !nosanitize
37 // CHECK: [[SLOW]]
38 // ITANIUM: call void @__cfi_slowpath_diag(i64 7004155349499253778, ptr %[[VT]], {{.*}}) {{.*}} !nosanitize
39 // MS: call void @__cfi_slowpath_diag(i64 -8005289897957287421, ptr %[[VT]], {{.*}}) {{.*}} !nosanitize
40 // CHECK: br label %[[CONT]], !nosanitize
41 // CHECK: [[CONT]]
42 // CHECK: call void %{{.*}}(ptr {{[^,]*}} %{{.*}})
44 // No hash-based bit set entry for (anonymous namespace)::B
45 // ITANIUM-NOT: !{i64 {{.*}}, ptr @_ZTVN12_GLOBAL__N_11BE,
46 // MS-NOT: !{i64 {{.*}}, ptr @[[B_VTABLE]],