Skip to content

Commit b2609f1

Browse files
committed
Fix conflict resolution for vtable info to be [0 x ptr] in 8a2d68f
1 parent 63da2bc commit b2609f1

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

clang/lib/CodeGen/ItaniumCXXABI.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -3710,8 +3710,8 @@ void ItaniumRTTIBuilder::BuildVTablePointer(const Type *Ty) {
37103710
if (CGM.getItaniumVTableContext().isRelativeLayout())
37113711
VTable = CGM.getModule().getNamedAlias(VTableName);
37123712
if (!VTable) {
3713-
llvm::Type *Ty = llvm::ArrayType::get(CGM.GlobalsInt8PtrTy, 0);
3714-
VTable = CGM.getModule().getOrInsertGlobal(VTableName, Ty);
3713+
llvm::Type *Ty = llvm::ArrayType::get(CGM.DefaultInt8PtrTy, 0);
3714+
VTable = CGM.CreateRuntimeVariable(Ty, VTableName);
37153715
}
37163716

37173717
CGM.setDSOLocal(cast<llvm::GlobalValue>(VTable->stripPointerCasts()));

clang/test/CodeGenSYCL/simple-sycl-virtual-function.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// RUN: %clang_cc1 -triple spir64 -fsycl-allow-virtual-functions -fsycl-is-device -emit-llvm %s -o - | FileCheck %s --check-prefixes CHECK,CHECK-PTR
66
// RUN: %clang_cc1 -triple spir64 -fsycl-allow-virtual-functions -fsycl-is-device -fexperimental-relative-c++-abi-vtables -emit-llvm %s -o - | FileCheck %s --check-prefixes CHECK,CHECK-REL
77

8-
// CHECK: @_ZTVN10__cxxabiv120__si_class_type_infoE = external addrspace(1) global ptr addrspace(4)
9-
// CHECK: @_ZTVN10__cxxabiv117__class_type_infoE = external addrspace(1) global ptr addrspace(4)
8+
// CHECK: @_ZTVN10__cxxabiv120__si_class_type_infoE = external addrspace(1) global [0 x ptr addrspace(4)]
9+
// CHECK: @_ZTVN10__cxxabiv117__class_type_infoE = external addrspace(1) global [0 x ptr addrspace(4)]
1010
// CHECK-PTR: @_ZTI4Base = linkonce_odr constant { ptr addrspace(4), ptr } { ptr addrspace(4) getelementptr inbounds (ptr addrspace(4), ptr addrspace(4) addrspacecast (ptr addrspace(1) @_ZTVN10__cxxabiv117__class_type_infoE to ptr addrspace(4)), i64 2)
1111
// CHECK-PTR: @_ZTI8Derived1 = linkonce_odr constant { ptr addrspace(4), ptr, ptr } { ptr addrspace(4) getelementptr inbounds (ptr addrspace(4), ptr addrspace(4) addrspacecast (ptr addrspace(1) @_ZTVN10__cxxabiv120__si_class_type_infoE to ptr addrspace(4)), i64 2)
1212
// CHECK-REL: @_ZTI4Base = linkonce_odr constant { ptr addrspace(4), ptr } { ptr addrspace(4) getelementptr inbounds (i8, ptr addrspace(4) addrspacecast (ptr addrspace(1) @_ZTVN10__cxxabiv117__class_type_infoE to ptr addrspace(4)), i32 8)

clang/test/CodeGenSYCL/virtual-types.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int main() {
2121
// CHECK: %struct.Struct = type { ptr }
2222
// VTable:
2323
// CHECK: @_ZTV6Struct = linkonce_odr unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr @_ZTI6Struct, ptr @_ZN6Struct3fooEv] }, comdat, align 8
24-
// CHECK: @[[TYPEINFO:.+]] = external addrspace(1) global ptr addrspace(4)
24+
// CHECK: @[[TYPEINFO:.+]] = external addrspace(1) global [0 x ptr addrspace(4)]
2525
// TypeInfo Name:
2626
// CHECK: @_ZTS6Struct = linkonce_odr constant [8 x i8] c"6Struct\00", comdat, align 1
2727
// TypeInfo:

0 commit comments

Comments
 (0)