[llvm] [SPIR-V] Emit DebugTypePointer from NonSemantic DI (PR #109287)
Michal Paszkowski via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 6 20:36:35 PDT 2024
================
@@ -146,8 +148,21 @@ bool SPIRVEmitNonSemanticDI::emitGlobalDI(MachineFunction &MF) {
for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange())) {
DILocalVariable *LocalVariable = DVR.getVariable();
if (auto *BasicType =
- dyn_cast<DIBasicType>(LocalVariable->getType()))
+ dyn_cast<DIBasicType>(LocalVariable->getType())) {
BasicTypes.insert(BasicType);
+ } else if (auto *DerivedType =
+ dyn_cast<DIDerivedType>(LocalVariable->getType())) {
+ if (DerivedType->getTag() == dwarf::DW_TAG_pointer_type) {
+ PointerDerivedTypes.insert(DerivedType);
+ // DIBasicType can be unreachable from DbgRecord and only
+ // pointed on from other DI types
+ // DerivedType->getBaseType is null when pointer
+ // is representing a void type
+ if (DerivedType->getBaseType())
+ BasicTypes.insert(
+ cast<DIBasicType>(DerivedType->getBaseType()));
+ }
+ }
}
}
----------------
michalpaszkowski wrote:
Marking as resolved. @bwlodarcz is right. The number of casts needed here outweighs the one additional nesting.
https://github.com/llvm/llvm-project/pull/109287
More information about the llvm-commits
mailing list