Skip to content

Commit 39fe925

Browse files
aratajewigcbot
authored andcommitted
Set DWARF version even though it was set to 0 by a SPIRV producer
SPIRV producers may produce DWARF version = 0, especially on Windows, where default debug info format is CodeView. The IGC must decide on the final DWARF version independently in this case.
1 parent 0fe066b commit 39fe925

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

IGC/DebugInfo/DwarfDebug.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,12 @@ static unsigned getDwarfVersionFromModule(const Module *M) {
273273
cast_or_null<ConstantAsMetadata>(M->getModuleFlag("Dwarf Version"));
274274
if (!Val)
275275
return dwarf::DWARF_VERSION;
276-
return (unsigned)(cast<ConstantInt>(Val->getValue())->getZExtValue());
276+
277+
unsigned Version = cast<ConstantInt>(Val->getValue())->getZExtValue();
278+
if (Version == 0)
279+
return dwarf::DWARF_VERSION;
280+
281+
return Version;
277282
}
278283

279284
void DwarfDISubprogramCache::updateDISPCache(const llvm::Function *F) {

0 commit comments

Comments
 (0)