Skip to content

Commit c05b5f2

Browse files
pratikashargfxbot
authored andcommitted
Fix order of size and offset in DW_OP_bit_piece expression
Change-Id: Ib5f45298024a4f58702534335194311a5fa8d87f
1 parent 5dad9ab commit c05b5f2

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

IGC/Compiler/DebugInfo/DwarfCompileUnit.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,14 +1702,9 @@ void CompileUnit::buildGeneral(DbgVariable& var, DIE* die, VISAVariableLocation*
17021702

17031703
if (varInfo.getGRF().subRegNum != 0)
17041704
{
1705-
enum
1706-
{
1707-
REG_SIZE_BITS = 256
1708-
};
1709-
17101705
unsigned int subReg = varInfo.getGRF().subRegNum;
17111706
auto offsetInBits = subReg * 8;
1712-
auto sizeInBits = REG_SIZE_BITS - offsetInBits;
1707+
auto sizeInBits = (m_pModule->m_pShader->getGRFSize()*8) - offsetInBits;
17131708

17141709
addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_bit_piece);
17151710
addUInt(Block, dwarf::DW_FORM_data1, sizeInBits);

IGC/Compiler/DebugInfo/DwarfDebug.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,10 +1402,10 @@ void DwarfDebug::collectVariableInfo(const Function *MF, SmallPtrSet<const MDNod
14021402
auto sizeInBits = (m_pModule->m_pShader->getGRFSize()*8) - offsetInBits;
14031403

14041404
write(dotLoc.loc, (uint8_t)llvm::dwarf::DW_OP_bit_piece);
1405-
encodeULEB128(offsetInBits, bufLEB128);
1406-
write(dotLoc.loc, (unsigned char*)bufLEB128, offsetLEB128Size);
1407-
encodeULEB128(sizeInBits, bufLEB128);
1405+
sizeLEB128Size = encodeULEB128(sizeInBits, bufLEB128);
14081406
write(dotLoc.loc, (unsigned char*)bufLEB128, sizeLEB128Size);
1407+
offsetLEB128Size = encodeULEB128(offsetInBits, bufLEB128);
1408+
write(dotLoc.loc, (unsigned char*)bufLEB128, offsetLEB128Size);
14091409
}
14101410
}
14111411
else if (varInfo.isSpill())

0 commit comments

Comments
 (0)