================
@@ -0,0 +1,77 @@
+// Test that Clang emits vtable metadata when speculative devirtualization is
enabled.
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -fdevirtualize-speculatively
-emit-llvm -o - %s | FileCheck --check-prefix=VTABLE-OPT
--check-prefix=TT-ITANIUM-DEFAULT-NOLTO-SPECULATIVE-DEVIRT %s
+
+struct A {
+ A();
+ virtual void f();
+};
+
+struct B : virtual A {
+ B();
+ virtual void g();
+ virtual void h();
+};
+
+namespace {
+
+struct D : B {
+ D();
+ virtual void f();
+ virtual void h();
+};
+
+}
+
+A::A() {}
+B::B() {}
+D::D() {}
+
+void A::f() {
+}
+
+void B::g() {
+}
+
+void D::f() {
+}
+
+void D::h() {
+}
+
+void af(A *a) {
+ // TT-ITANIUM-DEFAULT-NOLTO-SPECULATIVE-DEVIRT: [[P:%[^ ]*]] = call i1
@llvm.public.type.test(ptr [[VT:%[^ ]*]], metadata !"_ZTS1A")
----------------
teresajohnson wrote:
Nit: does this check label need to be so long? Does it even need to be distinct
from VTABLE-OPT since they must be used together? They could both simply be
CHECK without any loss of clarity I think. Actually that would probably be
clearer.
https://github.com/llvm/llvm-project/pull/159685
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits