Files
clang-p2996/clang/test/CodeGenCXX/RelativeVTablesABI/virtual-function-call.cpp
Nikita Popov 89810cee54 [RelativeVTablesABI] Convert tests to opaque pointers (NFC)
Converted using https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34
with manual fixup, primarily to drop check lines for types that
no longer appear with opaque pointers.
2022-10-06 12:37:42 +02:00

21 lines
593 B
C++

// Check that we call llvm.load.relative() on a vtable function call.
// RUN: %clang_cc1 %s -triple=aarch64-unknown-fuchsia -O3 -S -o - -emit-llvm | FileCheck %s
// CHECK: define{{.*}} void @_Z5A_fooP1A(ptr noundef %a) local_unnamed_addr
// CHECK-NEXT: entry:
// CHECK-NEXT: %vtable = load ptr, ptr %a
// CHECK-NEXT: [[func_ptr:%[0-9]+]] = tail call ptr @llvm.load.relative.i32(ptr %vtable, i32 0)
// CHECK-NEXT: tail call void [[func_ptr]](ptr {{[^,]*}} %a)
// CHECK-NEXT: ret void
// CHECK-NEXT: }
class A {
public:
virtual void foo();
};
void A_foo(A *a) {
a->foo();
}