[clang] bf9b72e - [NFC][Clang] Precommit test for VTable codegen (#124983)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 19 18:14:06 PST 2025
Author: Anshil Gandhi
Date: 2025-02-19T21:14:02-05:00
New Revision: bf9b72e134bff7eb6861e07752d70cb33348b540
URL: https://github.com/llvm/llvm-project/commit/bf9b72e134bff7eb6861e07752d70cb33348b540
DIFF: https://github.com/llvm/llvm-project/commit/bf9b72e134bff7eb6861e07752d70cb33348b540.diff
LOG: [NFC][Clang] Precommit test for VTable codegen (#124983)
Associated PR: https://github.com/llvm/llvm-project/pull/124989
Added:
clang/test/CodeGenCUDA/increment-index-for-thunks.cu
Modified:
Removed:
################################################################################
diff --git a/clang/test/CodeGenCUDA/increment-index-for-thunks.cu b/clang/test/CodeGenCUDA/increment-index-for-thunks.cu
new file mode 100644
index 0000000000000..af764198f5ea7
--- /dev/null
+++ b/clang/test/CodeGenCUDA/increment-index-for-thunks.cu
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -target-cpu gfx942 \
+// RUN: -emit-llvm -xhip %s -o - | FileCheck %s --check-prefix=GCN
+// RUN: %clang_cc1 -fcuda-is-device -triple spirv64-amd-amdhsa \
+// RUN: -emit-llvm -xhip %s -o - | FileCheck %s --check-prefix=SPIRV
+
+// GCN: @_ZTV1C = linkonce_odr unnamed_addr addrspace(1) constant { [5 x ptr addrspace(1)], [4 x ptr addrspace(1)] } { [5 x ptr addrspace(1)] [ptr addrspace(1) null, ptr addrspace(1) null, ptr addrspace(1) addrspacecast (ptr @_ZN1B2f2Ev to ptr addrspace(1)), ptr addrspace(1) null, ptr addrspace(1) addrspacecast (ptr @_ZN1C2f1Ev to ptr addrspace(1))], [4 x ptr addrspace(1)] [ptr addrspace(1) inttoptr (i64 -8 to ptr addrspace(1)), ptr addrspace(1) null, ptr addrspace(1) null, ptr addrspace(1) addrspacecast (ptr @_ZN1C2f1Ev to ptr addrspace(1))] }, comdat, align 8
+// GCN: @_ZTV1B = linkonce_odr unnamed_addr addrspace(1) constant { [3 x ptr addrspace(1)] } { [3 x ptr addrspace(1)] [ptr addrspace(1) null, ptr addrspace(1) null, ptr addrspace(1) addrspacecast (ptr @_ZN1B2f2Ev to ptr addrspace(1))] }, comdat, align 8
+// GCN: @_ZTV1A = linkonce_odr unnamed_addr addrspace(1) constant { [4 x ptr addrspace(1)] } { [4 x ptr addrspace(1)] [ptr addrspace(1) null, ptr addrspace(1) null, ptr addrspace(1) null, ptr addrspace(1) addrspacecast (ptr @__cxa_pure_virtual to ptr addrspace(1))] }, comdat, align 8
+// SPIRV: @_ZTV1C = linkonce_odr unnamed_addr addrspace(1) constant { [5 x ptr addrspace(1)], [4 x ptr addrspace(1)] } { [5 x ptr addrspace(1)] [ptr addrspace(1) null, ptr addrspace(1) null, ptr addrspace(1) addrspacecast (ptr addrspace(4) @_ZN1B2f2Ev to ptr addrspace(1)), ptr addrspace(1) null, ptr addrspace(1) addrspacecast (ptr addrspace(4) @_ZN1C2f1Ev to ptr addrspace(1))], [4 x ptr addrspace(1)] [ptr addrspace(1) inttoptr (i64 -8 to ptr addrspace(1)), ptr addrspace(1) null, ptr addrspace(1) null, ptr addrspace(1) addrspacecast (ptr addrspace(4) @_ZN1C2f1Ev to ptr addrspace(1))] }, comdat, align 8
+// SPIRV: @_ZTV1B = linkonce_odr unnamed_addr addrspace(1) constant { [3 x ptr addrspace(1)] } { [3 x ptr addrspace(1)] [ptr addrspace(1) null, ptr addrspace(1) null, ptr addrspace(1) addrspacecast (ptr addrspace(4) @_ZN1B2f2Ev to ptr addrspace(1))] }, comdat, align 8
+// SPIRV: @_ZTV1A = linkonce_odr unnamed_addr addrspace(1) constant { [4 x ptr addrspace(1)] } { [4 x ptr addrspace(1)] [ptr addrspace(1) null, ptr addrspace(1) null, ptr addrspace(1) null, ptr addrspace(1) addrspacecast (ptr addrspace(4) @__cxa_pure_virtual to ptr addrspace(1))] }, comdat, align 8
+
+struct A {
+ __attribute__((device)) A() { }
+ virtual void neither_device_nor_host_f() = 0 ;
+ __attribute__((device)) virtual void f1() = 0;
+
+};
+
+struct B {
+ __attribute__((device)) B() { }
+ __attribute__((device)) virtual void f2() { };
+};
+
+struct C : public B, public A {
+ __attribute__((device)) C() : B(), A() { }
+
+ virtual void neither_device_nor_host_f() override { }
+ __attribute__((device)) virtual void f1() override { }
+
+};
+
+__attribute__((device)) void test() {
+ C obj;
+}
More information about the cfe-commits
mailing list