Skip to content

Commit cb6e1e3

Browse files
jcranmer-inteldbudanov-cmplr
authored andcommitted
Drop the JointMatrixINTEL struct-renaming pass when opaque pointers are enabled. (#1570)
The frontend is being changed to lower the struct name to the correct LLVM name directly, obviating the need for this check. See #6535 for this change. This marks the removal of the final call to the deprecated method Type::getPointerElementType, although there remains some code that is not fully working with opaque pointers enabled. Original commit: KhronosGroup/SPIRV-LLVM-Translator@e2bb479
1 parent bb6f20e commit cb6e1e3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

llvm-spirv/lib/SPIRV/SPIRVRegularizeLLVM.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,10 @@ void SPIRVRegularizeLLVMBase::adaptStructTypes(StructType *ST) {
354354
STName.consume_front("__spv::");
355355
StringRef MangledName = STName.substr(0, STName.find('.'));
356356

357+
// Older versions of clang will generate JointMatrixINTEL types using this
358+
// representation. Newer versions will generate the correct struct name
359+
// "%spirv.JointMatrixINTEL._{parameters}" directly, obviating the need for
360+
// this check.
357361
// Representation in LLVM IR before the translator is a pointer array wrapped
358362
// in a structure:
359363
// %struct.__spirv_JointMatrixINTEL = type { [R x [C x [L x [S x type]]]]* }
@@ -370,12 +374,13 @@ void SPIRVRegularizeLLVMBase::adaptStructTypes(StructType *ST) {
370374
// register by OpCompositeConstruct. And we can't claim, that the Result type
371375
// of OpCompositeConstruct instruction is always the joint matrix type, it's
372376
// simply not true.
373-
if (MangledName == "__spirv_JointMatrixINTEL") {
377+
if (MangledName == "__spirv_JointMatrixINTEL" && !ST->isOpaquePointerTy()) {
374378
auto *PtrTy = dyn_cast<PointerType>(ST->getElementType(0));
375379
assert(PtrTy &&
376380
"Expected a pointer to an array to represent joint matrix type");
377381
std::vector<size_t> TypeLayout;
378-
ArrayType *ArrayTy = dyn_cast<ArrayType>(PtrTy->getPointerElementType());
382+
ArrayType *ArrayTy =
383+
dyn_cast<ArrayType>(PtrTy->getNonOpaquePointerElementType());
379384
assert(ArrayTy && "Expected a pointer element type of an array type to "
380385
"represent joint matrix type");
381386
TypeLayout.push_back(ArrayTy->getNumElements());

0 commit comments

Comments
 (0)