@@ -116,8 +116,8 @@ mlir::LLVM::DITypeAttr DebugTypeGenerator::convertBoxedSequenceType(
116
116
unsigned offset = dimsOffset;
117
117
const unsigned indexSize = dimsSize / 3 ;
118
118
for ([[maybe_unused]] auto _ : seqTy.getShape ()) {
119
- // For each dimension, find the offset of count and lower bound in the
120
- // descriptor and generate the dwarf expression to extract it.
119
+ // For each dimension, find the offset of count, lower bound and stride in
120
+ // the descriptor and generate the dwarf expression to extract it.
121
121
// FIXME: If `indexSize` happens to be bigger than address size on the
122
122
// system then we may have to change 'DW_OP_deref' here.
123
123
addOp (llvm::dwarf::DW_OP_push_object_address, {});
@@ -139,10 +139,18 @@ mlir::LLVM::DITypeAttr DebugTypeGenerator::convertBoxedSequenceType(
139
139
mlir::LLVM::DIExpressionAttr::get (context, ops);
140
140
ops.clear ();
141
141
142
+ addOp (llvm::dwarf::DW_OP_push_object_address, {});
143
+ addOp (llvm::dwarf::DW_OP_plus_uconst,
144
+ {offset + (indexSize * kDimStridePos )});
145
+ addOp (llvm::dwarf::DW_OP_deref, {});
146
+ // stride[i] = *(base_addr + offset + (indexSize * kDimStridePos))
147
+ mlir::LLVM::DIExpressionAttr strideAttr =
148
+ mlir::LLVM::DIExpressionAttr::get (context, ops);
149
+ ops.clear ();
150
+
142
151
offset += dimsSize;
143
152
mlir::LLVM::DISubrangeAttr subrangeTy = mlir::LLVM::DISubrangeAttr::get (
144
- context, countAttr, lowerAttr, /* upperBound=*/ nullptr ,
145
- /* stride=*/ nullptr );
153
+ context, countAttr, lowerAttr, /* upperBound=*/ nullptr , strideAttr);
146
154
elements.push_back (subrangeTy);
147
155
}
148
156
return mlir::LLVM::DICompositeTypeAttr::get (
0 commit comments