Skip to content

Commit b8eba23

Browse files
MiloszSkobejkoigcbot
authored andcommitted
Fix skip to DW_OP_stack_value in DWARF split variables
When building a sliced variable, we are emitting two SIMD16 subprograms. Currently only the upper half lanes (16-31) reaches the `DW_OP_stack_value` at the end of the source variable's DI Block. The first-half lanes (0-15) are skipped to the end of the block after emitting the first half, making the variable unreadable in the debugger.
1 parent b241fec commit b8eba23

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

IGC/DebugInfo/DwarfCompileUnit.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2775,6 +2775,7 @@ IGC::DIEBlock *CompileUnit::buildGeneral(
27752775
offsetTaken = 0;
27762776
skipOff = nullptr;
27772777
emitLocation = false;
2778+
stackValueOffset = 0;
27782779

27792780
LLVM_DEBUG(dbgs() << " building DWARF info for the variable ["
27802781
<< var.getName() << "]\n");
@@ -2810,7 +2811,9 @@ IGC::DIEBlock *CompileUnit::buildGeneral(
28102811
}
28112812

28122813
if (skipOff) {
2813-
unsigned int offsetEnd = Block->ComputeSizeOnTheFly(Asm);
2814+
// In split SIMD case, we want to skip to DW_OP_stack_value at the end,
2815+
// not past it.
2816+
unsigned int offsetEnd = Block->ComputeSizeOnTheFly(Asm) - stackValueOffset;
28142817
cast<DIEInteger>(skipOff)->setValue(offsetEnd - offsetTaken);
28152818
}
28162819

IGC/DebugInfo/DwarfCompileUnit.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ class CompileUnit {
527527
DIEBlock *buildGeneral(DbgVariable &, const VISAVariableLocation &,
528528
const std::vector<DbgDecoder::LiveIntervalsVISA> *,
529529
IGC::DIE *);
530+
unsigned int stackValueOffset = 0;
530531

531532
private:
532533
bool buildPrivateBaseRegBased(const DbgVariable &, IGC::DIEBlock *,

IGC/DebugInfo/DwarfDebug.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ void DbgVariable::emitExpression(CompileUnit *CU, IGC::DIEBlock *Block) const {
232232

233233
if (isStackValueNeeded) {
234234
CU->addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_stack_value);
235+
CU->stackValueOffset = 1;
235236
}
236237
}
237238

IGC/ocloc_tests/DebugInfo/simd32-sliced-stack-value.cl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ kernel void test(global int* in, global int* out) {
7777
// CHECK-DWARF-SAME: (DW_OP_INTEL_push_simd_lane; DW_OP_lit16; DW_OP_ge; DW_OP_bra: [[GID_BR:[0-9]+]];
7878
// CHECK-DWARF-SAME: DW_OP_INTEL_push_simd_lane; DW_OP_lit3; DW_OP_shr; DW_OP_plus_uconst: {{[0-9]+}};
7979
// CHECK-DWARF-SAME: DW_OP_INTEL_push_simd_lane; [[GID_MAIN_EXPR:DW_OP_lit7; DW_OP_and; DW_OP_const1u: 32; DW_OP_mul; DW_OP_INTEL_regval_bits: 32; DW_OP_const4u: 4294967295; DW_OP_and]];
80-
// CHECK-DWARF-SAME: DW_OP_skip: [[GID_BR]];
80+
// COM: skip to DW_OP_stack_value, where all lanes should meet
81+
// CHECK-DWARF-SAME: DW_OP_skip: 21
8182
// CHECK-DWARF-SAME: DW_OP_INTEL_push_simd_lane; DW_OP_lit16; DW_OP_minus; DW_OP_lit3; DW_OP_shr; DW_OP_plus_uconst: {{[0-9]+}};
8283
// CHECK-DWARF-SAME: DW_OP_INTEL_push_simd_lane; [[GID_MAIN_EXPR]]; DW_OP_stack_value)
8384
// CHECK-DWARF-NEXT: <End of list>
@@ -86,7 +87,8 @@ kernel void test(global int* in, global int* out) {
8687
// CHECK-DWARF-SAME: (DW_OP_INTEL_push_simd_lane; DW_OP_lit16; DW_OP_ge; DW_OP_bra: [[MUL_BR:[0-9]+]];
8788
// CHECK-DWARF-SAME: DW_OP_INTEL_push_simd_lane; DW_OP_lit3; DW_OP_shr; DW_OP_plus_uconst: {{[0-9]+}};
8889
// CHECK-DWARF-SAME: DW_OP_INTEL_push_simd_lane; [[MUL_MAIN_EXPR:DW_OP_lit7; DW_OP_and; DW_OP_const1u: 32; DW_OP_mul; DW_OP_INTEL_regval_bits: 32]];
89-
// CHECK-DWARF-SAME: DW_OP_skip: [[MUL_BR]];
90+
// COM: skip to DW_OP_stack_value, where all lanes should meet
91+
// CHECK-DWARF-SAME: DW_OP_skip: 15
9092
// CHECK-DWARF-SAME: DW_OP_INTEL_push_simd_lane; DW_OP_lit16; DW_OP_minus; DW_OP_lit3; DW_OP_shr; DW_OP_plus_uconst: {{[0-9]+}};
9193
// CHECK-DWARF-SAME: DW_OP_INTEL_push_simd_lane; [[MUL_MAIN_EXPR]]; DW_OP_stack_value)
9294
// CHECK-DWARF-NEXT: <End of list>

0 commit comments

Comments
 (0)