Skip to content

Commit 1cdca1b

Browse files
annkrsigcbot
authored andcommitted
Fix generation of DWARF location for variables with non-empty
DIExpression v5: -Add concise LIT test
1 parent 064510c commit 1cdca1b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

IGC/DebugInfo/DwarfCompileUnit.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2395,7 +2395,8 @@ bool CompileUnit::buildPrivateBaseRegBased(const DbgVariable &var,
23952395
LLVM_DEBUG(dbgs() << " PrivateBase(%X) + (%PerThreadOffset + "
23962396
" (simdSize*<var_offset>) + (simdLaneId * <var_size>))");
23972397

2398-
const auto *storageMD = var.getDbgInst()->getMetadata("StorageOffset");
2398+
const auto *DbgInst = var.getDbgInst();
2399+
const auto *storageMD = DbgInst->getMetadata("StorageOffset");
23992400
IGC_ASSERT(storageMD != nullptr);
24002401
const auto *VISAMod = loc.GetVISAModule();
24012402
auto privateBaseRegNum = VISAMod->getPrivateBaseReg();
@@ -2414,6 +2415,7 @@ bool CompileUnit::buildPrivateBaseRegBased(const DbgVariable &var,
24142415
// Per Thread Offset 11 DW_OP_plus_uconst offset , i.e. simdSize * <variable
24152416
// offset> 12 DW_OP_INTEL_push_simd_lane 13 DW_OP_const1u/2u/4u/8u
24162417
// <variableSize> , i.e. size in bytes 14 DW_OP_mul 15 DW_OP_plus
2418+
// 16 remaining opcodes from DIExpression
24172419
auto simdSize = VISAMod->GetSIMDSize();
24182420

24192421
// Rely on getVarInfo result here.
@@ -2526,6 +2528,15 @@ bool CompileUnit::buildPrivateBaseRegBased(const DbgVariable &var,
25262528
addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_mul); // 14 DW_OP_mul
25272529
addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_plus); // 15 DW_OP_plus
25282530

2531+
// 16 remaining opcodes from DIExpression
2532+
const DIExpression *DIExpr = DbgInst->getExpression();
2533+
for (auto I = DIExpr->expr_op_begin(), E = DIExpr->expr_op_end(); I != E;
2534+
++I) {
2535+
auto op = I->getOp();
2536+
auto BF = DIEInteger::BestForm(false, op);
2537+
addUInt(Block, BF, op);
2538+
}
2539+
25292540
return true;
25302541
}
25312542

0 commit comments

Comments
 (0)