Skip to content

Commit 8dcd16c

Browse files
authored
[DebugInfo] Correctly use cached DICompilationUnit (#2080)
Followup for #2072 Signed-off-by: Sidorov, Dmitry <[email protected]>
1 parent 0dc80be commit 8dcd16c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/SPIRV/SPIRVToLLVMDbgTran.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ SPIRVToLLVMDbgTran::transCompilationUnit(const SPIRVExtInst *DebugInst,
174174
// Do nothing in case we have already translated the CU (e.g. during
175175
// DebugEntryPoint translation)
176176
if (BuilderMap[DebugInst->getId()])
177-
return nullptr;
177+
return cast<DICompileUnit>(DebugInstCache[DebugInst]);
178178

179179
const SPIRVWordVec &Ops = DebugInst->getArguments();
180180

test/DebugInfo/NonSemantic/Shader200/DebugTypeDef.ll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV
66
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-debug-info-version=nonsemantic-shader-200
77
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
8-
; RUN: llvm-dis %t.rev.bc
8+
; RUN: llvm-dis %t.rev.bc
99
; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM
1010

1111
; CHECK-SPIRV: String [[#TestStr:]] "test.cpp"
@@ -50,3 +50,7 @@ attributes #0 = { convergent mustprogress norecurse nounwind }
5050
!14 = distinct !DISubprogram(name: "_ZTSZ4mainEUlvE_", scope: !1, file: !1, line: 24, type: !15, flags: DIFlagArtificial | DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
5151
!15 = !DISubroutineType(cc: DW_CC_nocall, types: !16)
5252
!16 = !{null}
53+
!17 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !18, entity: !19, file: !1, line: 58)
54+
!18 = !DINamespace(name: "std", scope: null)
55+
!19 = !DIDerivedType(tag: DW_TAG_typedef, name: "max_align_t", file: !1, baseType: !20)
56+
!20 = !DICompositeType(tag: DW_TAG_structure_type, file: !8, line: 19, size: 256, flags: DIFlagFwdDecl, elements: !2, identifier: "_ZTS11max_align_t")

0 commit comments

Comments
 (0)