@@ -213,23 +213,26 @@ mlir::LLVM::DITypeAttr DebugTypeGenerator::convertSequenceType(
213
213
convertType (seqTy.getEleTy (), fileAttr, scope, declOp);
214
214
215
215
unsigned index = 0 ;
216
+ auto intTy = mlir::IntegerType::get (context, 64 );
216
217
for (fir::SequenceType::Extent dim : seqTy.getShape ()) {
218
+ int64_t shift = 1 ;
219
+ if (declOp && declOp.getShift ().size () > index) {
220
+ if (std::optional<std::int64_t > optint =
221
+ getIntIfConstant (declOp.getShift ()[index]))
222
+ shift = *optint;
223
+ }
217
224
if (dim == seqTy.getUnknownExtent ()) {
225
+ mlir::IntegerAttr lowerAttr = nullptr ;
226
+ if (declOp && declOp.getShift ().size () > index)
227
+ lowerAttr = mlir::IntegerAttr::get (intTy, llvm::APInt (64 , shift));
218
228
// FIXME: This path is taken for assumed size arrays but also for arrays
219
229
// with non constant extent. For the latter case, the DISubrangeAttr
220
230
// should point to a variable which will have the extent at runtime.
221
231
auto subrangeTy = mlir::LLVM::DISubrangeAttr::get (
222
- context, /* count=*/ nullptr , /* lowerBound= */ nullptr ,
223
- /* upperBound */ nullptr , /* stride*/ nullptr );
232
+ context, /* count=*/ nullptr , lowerAttr, /* upperBound */ nullptr ,
233
+ /* stride*/ nullptr );
224
234
elements.push_back (subrangeTy);
225
235
} else {
226
- auto intTy = mlir::IntegerType::get (context, 64 );
227
- int64_t shift = 1 ;
228
- if (declOp && declOp.getShift ().size () > index) {
229
- if (std::optional<std::int64_t > optint =
230
- getIntIfConstant (declOp.getShift ()[index]))
231
- shift = *optint;
232
- }
233
236
auto countAttr = mlir::IntegerAttr::get (intTy, llvm::APInt (64 , dim));
234
237
auto lowerAttr = mlir::IntegerAttr::get (intTy, llvm::APInt (64 , shift));
235
238
auto subrangeTy = mlir::LLVM::DISubrangeAttr::get (
0 commit comments