Skip to content

Commit fc4b1a3

Browse files
authored
[flang][debug] Handle array types with variable size/bounds. (#110686)
The debug information generated by flang did not handle the cases where dimension or lower bounds of the arrays were variable. This PR fixes this issue. It will help distinguish assumed size arrays from cases where array size are variable. It also handles the variable lower bounds for assumed shape arrays. Fixes #98879.
1 parent 428ae0f commit fc4b1a3

11 files changed

+164
-49
lines changed

flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp

Lines changed: 67 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,35 @@ static mlir::LLVM::DITypeAttr genPlaceholderType(mlir::MLIRContext *context) {
7878
/*bitSize=*/32, llvm::dwarf::DW_ATE_signed);
7979
}
8080

81+
// Helper function to create DILocalVariableAttr and DbgValueOp when information
82+
// about the size or dimension of a variable etc lives in an mlir::Value.
83+
mlir::LLVM::DILocalVariableAttr DebugTypeGenerator::generateArtificialVariable(
84+
mlir::MLIRContext *context, mlir::Value val,
85+
mlir::LLVM::DIFileAttr fileAttr, mlir::LLVM::DIScopeAttr scope,
86+
fir::cg::XDeclareOp declOp) {
87+
// There can be multiple artificial variable for a single declOp. To help
88+
// distinguish them, we pad the name with a counter. The counter is the
89+
// position of 'val' in the operands of declOp.
90+
auto varID = std::distance(
91+
declOp.getOperands().begin(),
92+
std::find(declOp.getOperands().begin(), declOp.getOperands().end(), val));
93+
mlir::OpBuilder builder(context);
94+
auto name = mlir::StringAttr::get(context, "." + declOp.getUniqName().str() +
95+
std::to_string(varID));
96+
builder.setInsertionPoint(declOp);
97+
mlir::Type type = val.getType();
98+
if (!mlir::isa<mlir::IntegerType>(type) || !type.isSignlessInteger()) {
99+
type = builder.getIntegerType(64);
100+
val = builder.create<fir::ConvertOp>(declOp.getLoc(), type, val);
101+
}
102+
mlir::LLVM::DITypeAttr Ty = convertType(type, fileAttr, scope, declOp);
103+
auto lvAttr = mlir::LLVM::DILocalVariableAttr::get(
104+
context, scope, name, fileAttr, /*line=*/0, /*argNo=*/0,
105+
/*alignInBits=*/0, Ty, mlir::LLVM::DIFlags::Artificial);
106+
builder.create<mlir::LLVM::DbgValueOp>(declOp.getLoc(), val, lvAttr, nullptr);
107+
return lvAttr;
108+
}
109+
81110
mlir::LLVM::DITypeAttr DebugTypeGenerator::convertBoxedSequenceType(
82111
fir::SequenceType seqTy, mlir::LLVM::DIFileAttr fileAttr,
83112
mlir::LLVM::DIScopeAttr scope, fir::cg::XDeclareOp declOp,
@@ -122,11 +151,12 @@ mlir::LLVM::DITypeAttr DebugTypeGenerator::convertBoxedSequenceType(
122151
mlir::Attribute lowerAttr = nullptr;
123152
// If declaration has a lower bound, use it.
124153
if (declOp && declOp.getShift().size() > index) {
125-
// TODO: Handle case where lower bound is a variable (instead of a
126-
// constant as handled here)
127154
if (std::optional<std::int64_t> optint =
128155
getIntIfConstant(declOp.getShift()[index]))
129156
lowerAttr = mlir::IntegerAttr::get(intTy, llvm::APInt(64, *optint));
157+
else
158+
lowerAttr = generateArtificialVariable(
159+
context, declOp.getShift()[index], fileAttr, scope, declOp);
130160
}
131161
// FIXME: If `indexSize` happens to be bigger than address size on the
132162
// system then we may have to change 'DW_OP_deref' here.
@@ -320,31 +350,43 @@ mlir::LLVM::DITypeAttr DebugTypeGenerator::convertSequenceType(
320350
unsigned index = 0;
321351
auto intTy = mlir::IntegerType::get(context, 64);
322352
for (fir::SequenceType::Extent dim : seqTy.getShape()) {
323-
int64_t shift = 1;
353+
mlir::Attribute lowerAttr = nullptr;
354+
mlir::Attribute countAttr = nullptr;
355+
// If declOp is present, we use the shift in it to get the lower bound of
356+
// the array. If it is constant, that is used. If it is not constant, we
357+
// create a variable that represents its location and use that as lower
358+
// bound. As an optimization, we don't create a lower bound when shift is a
359+
// constant 1 as that is the default.
324360
if (declOp && declOp.getShift().size() > index) {
325361
if (std::optional<std::int64_t> optint =
326-
getIntIfConstant(declOp.getShift()[index]))
327-
shift = *optint;
362+
getIntIfConstant(declOp.getShift()[index])) {
363+
if (*optint != 1)
364+
lowerAttr = mlir::IntegerAttr::get(intTy, llvm::APInt(64, *optint));
365+
} else
366+
lowerAttr = generateArtificialVariable(
367+
context, declOp.getShift()[index], fileAttr, scope, declOp);
328368
}
369+
329370
if (dim == seqTy.getUnknownExtent()) {
330-
mlir::IntegerAttr lowerAttr = nullptr;
331-
if (declOp && declOp.getShift().size() > index)
332-
lowerAttr = mlir::IntegerAttr::get(intTy, llvm::APInt(64, shift));
333-
// FIXME: This path is taken for assumed size arrays but also for arrays
334-
// with non constant extent. For the latter case, the DISubrangeAttr
335-
// should point to a variable which will have the extent at runtime.
336-
auto subrangeTy = mlir::LLVM::DISubrangeAttr::get(
337-
context, /*count=*/nullptr, lowerAttr, /*upperBound*/ nullptr,
338-
/*stride*/ nullptr);
339-
elements.push_back(subrangeTy);
340-
} else {
341-
auto countAttr = mlir::IntegerAttr::get(intTy, llvm::APInt(64, dim));
342-
auto lowerAttr = mlir::IntegerAttr::get(intTy, llvm::APInt(64, shift));
343-
auto subrangeTy = mlir::LLVM::DISubrangeAttr::get(
344-
context, countAttr, lowerAttr, /*upperBound=*/nullptr,
345-
/*stride=*/nullptr);
346-
elements.push_back(subrangeTy);
347-
}
371+
// This path is taken for both assumed size array or when the size of the
372+
// array is variable. In the case of variable size, we create a variable
373+
// to use as countAttr. Note that fir has a constant size of -1 for
374+
// assumed size array. So !optint check makes sure we don't generate
375+
// variable in that case.
376+
if (declOp && declOp.getShape().size() > index) {
377+
std::optional<std::int64_t> optint =
378+
getIntIfConstant(declOp.getShape()[index]);
379+
if (!optint)
380+
countAttr = generateArtificialVariable(
381+
context, declOp.getShape()[index], fileAttr, scope, declOp);
382+
}
383+
} else
384+
countAttr = mlir::IntegerAttr::get(intTy, llvm::APInt(64, dim));
385+
386+
auto subrangeTy = mlir::LLVM::DISubrangeAttr::get(
387+
context, countAttr, lowerAttr, /*upperBound=*/nullptr,
388+
/*stride=*/nullptr);
389+
elements.push_back(subrangeTy);
348390
++index;
349391
}
350392
// Apart from arrays, the `DICompositeTypeAttr` is used for other things like
@@ -400,23 +442,8 @@ mlir::LLVM::DITypeAttr DebugTypeGenerator::convertCharacterType(
400442
// variable that will contain that length. This variable is used as
401443
// 'stringLength' in DIStringTypeAttr.
402444
if (declOp && !declOp.getTypeparams().empty()) {
403-
auto name =
404-
mlir::StringAttr::get(context, "." + declOp.getUniqName().str());
405-
mlir::OpBuilder builder(context);
406-
builder.setInsertionPoint(declOp);
407-
mlir::Value sizeVal = declOp.getTypeparams()[0];
408-
mlir::Type type = sizeVal.getType();
409-
if (!mlir::isa<mlir::IntegerType>(type) || !type.isSignlessInteger()) {
410-
type = builder.getIntegerType(64);
411-
sizeVal =
412-
builder.create<fir::ConvertOp>(declOp.getLoc(), type, sizeVal);
413-
}
414-
mlir::LLVM::DITypeAttr Ty = convertType(type, fileAttr, scope, declOp);
415-
auto lvAttr = mlir::LLVM::DILocalVariableAttr::get(
416-
context, scope, name, fileAttr, /*line=*/0, /*argNo=*/0,
417-
/*alignInBits=*/0, Ty, mlir::LLVM::DIFlags::Artificial);
418-
builder.create<mlir::LLVM::DbgValueOp>(declOp.getLoc(), sizeVal, lvAttr,
419-
nullptr);
445+
mlir::LLVM::DILocalVariableAttr lvAttr = generateArtificialVariable(
446+
context, declOp.getTypeparams()[0], fileAttr, scope, declOp);
420447
varAttr = mlir::cast<mlir::LLVM::DIVariableAttr>(lvAttr);
421448
}
422449
}

flang/lib/Optimizer/Transforms/DebugTypeGenerator.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ class DebugTypeGenerator {
6464
fir::cg::XDeclareOp declOp,
6565
bool genAllocated,
6666
bool genAssociated);
67+
mlir::LLVM::DILocalVariableAttr
68+
generateArtificialVariable(mlir::MLIRContext *context, mlir::Value Val,
69+
mlir::LLVM::DIFileAttr fileAttr,
70+
mlir::LLVM::DIScopeAttr scope,
71+
fir::cg::XDeclareOp declOp);
6772

6873
mlir::ModuleOp module;
6974
mlir::SymbolTable *symbolTable;

flang/test/Integration/debug-assumed-size-array.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ end module helper
1212

1313
! CHECK-DAG: ![[TY1:[0-9]+]] = !DICompositeType(tag: DW_TAG_array_type{{.*}}elements: ![[ELEMS1:[0-9]+]]{{.*}})
1414
! CHECK-DAG: ![[ELEMS1]] = !{![[ELM1:[0-9]+]], ![[EMPTY:[0-9]+]]}
15-
! CHECK-DAG: ![[ELM1]] = !DISubrange(count: 5, lowerBound: 1)
15+
! CHECK-DAG: ![[ELM1]] = !DISubrange(count: 5)
1616
! CHECK-DAG: ![[EMPTY]] = !DISubrange()
1717
! CHECK-DAG: ![[TY2:[0-9]+]] = !DICompositeType(tag: DW_TAG_array_type{{.*}}elements: ![[ELEMS2:[0-9]+]]{{.*}})
1818
! CHECK-DAG: ![[ELEMS2]] = !{![[EMPTY:[0-9]+]]}

flang/test/Integration/debug-fixed-array-type-2.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ function fn1(a1, b1, c1) result (res)
2323

2424
! CHECK-DAG: ![[INT:.*]] = !DIBasicType(name: "integer", size: 32, encoding: DW_ATE_signed)
2525
! CHECK-DAG: ![[REAL:.*]] = !DIBasicType(name: "real", size: 32, encoding: DW_ATE_float)
26-
! CHECK-DAG: ![[R1:.*]] = !DISubrange(count: 3, lowerBound: 1)
26+
! CHECK-DAG: ![[R1:.*]] = !DISubrange(count: 3)
2727
! CHECK-DAG: ![[SUB1:.*]] = !{![[R1]]}
2828
! CHECK-DAG: ![[D1TY:.*]] = !DICompositeType(tag: DW_TAG_array_type, baseType: ![[INT]], elements: ![[SUB1]])
2929

30-
! CHECK-DAG: ![[R21:.*]] = !DISubrange(count: 4, lowerBound: 1)
30+
! CHECK-DAG: ![[R21:.*]] = !DISubrange(count: 4)
3131
! CHECK-DAG: ![[R22:.*]] = !DISubrange(count: 5, lowerBound: -1)
3232
! CHECK-DAG: ![[SUB2:.*]] = !{![[R21]], ![[R22]]}
3333
! CHECK-DAG: ![[D2TY:.*]] = !DICompositeType(tag: DW_TAG_array_type, baseType: ![[INT]], elements: ![[SUB2]])
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
! RUN: %flang_fc1 -emit-llvm -debug-info-kind=standalone %s -o - | FileCheck %s
2+
3+
subroutine foo(a, n, m, p)
4+
integer n, m, p
5+
integer :: a(n:m, p)
6+
a(1, 2) = 10
7+
print *, a
8+
end subroutine foo
9+
10+
11+
! CHECK-DAG: ![[VAR0:.*]] = !DILocalVariable(name: "._QFfooEa3"{{.*}}scope: ![[SCOPE:[0-9]+]]{{.*}}flags: DIFlagArtificial)
12+
! CHECK-DAG: ![[VAR1:.*]] = !DILocalVariable(name: "._QFfooEa1"{{.*}}scope: ![[SCOPE]]{{.*}}flags: DIFlagArtificial)
13+
! CHECK-DAG: ![[VAR2:.*]] = !DILocalVariable(name: "._QFfooEa2"{{.*}}scope: ![[SCOPE]]{{.*}}flags: DIFlagArtificial)
14+
! CHECK-DAG: ![[SR1:.*]] = !DISubrange(count: ![[VAR1]], lowerBound: ![[VAR0]])
15+
! CHECK-DAG: ![[SR2:.*]] = !DISubrange(count: ![[VAR2]])
16+
! CHECK-DAG: ![[SR:.*]] = !{![[SR1]], ![[SR2]]}
17+
! CHECK-DAG: ![[TY:.*]] = !DICompositeType(tag: DW_TAG_array_type{{.*}}elements: ![[SR]])
18+
! CHECK-DAG: !DILocalVariable(name: "a"{{.*}}scope: ![[SCOPE]]{{.*}}type: ![[TY]])
19+

flang/test/Transforms/debug-107988.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
1313
#loc1 = loc("test.f90":5:1)
1414
#loc2 = loc("test.f90":15:1)
1515

16-
// CHECK: #[[VAR:.*]] = #llvm.di_local_variable<{{.*}}name = "._QFtestEstr"{{.*}}flags = Artificial>
16+
// CHECK: #[[VAR:.*]] = #llvm.di_local_variable<{{.*}}name = "._QFtestEstr{{.*}}flags = Artificial>
1717
// CHECK: func.func @test
1818
// CHECK: %[[V1:.*]]:2 = fir.unboxchar{{.*}}
1919
// CHECK: %[[V2:.*]] = fir.convert %[[V1]]#1 : (index) -> i64
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s | FileCheck %s
2+
3+
// Test assumed shape array with variable lower bound.
4+
5+
module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
6+
func.func private @_QFPfn(%arg0: !fir.box<!fir.array<?xi32>> {fir.bindc_name = "b"}, %arg1: !fir.ref<i32> {fir.bindc_name = "n"}) attributes {} {
7+
%c23_i32 = arith.constant 23 : i32
8+
%c6_i32 = arith.constant 6 : i32
9+
%c20_i32 = arith.constant 20 : i32
10+
%0 = fir.undefined !fir.dscope
11+
%1 = fircg.ext_declare %arg1 dummy_scope %0 {uniq_name = "_QFFfnEn"} : (!fir.ref<i32>, !fir.dscope) -> !fir.ref<i32> loc(#loc1)
12+
%2 = fir.load %1 : !fir.ref<i32>
13+
%3 = fir.convert %2 : (i32) -> index
14+
%4 = fircg.ext_declare %arg0 origin %3 dummy_scope %0 {uniq_name = "_QFFfnEb"} : (!fir.box<!fir.array<?xi32>>, index, !fir.dscope) -> !fir.box<!fir.array<?xi32>> loc(#loc2)
15+
return
16+
} loc(#loc3)
17+
}
18+
#loc1 = loc("test1.f90":1:1)
19+
#loc2 = loc("test1.f90":3:16)
20+
#loc3 = loc("test1.f90":4:16)
21+
22+
// CHECK: #[[VAR:.*]] = #llvm.di_local_variable<{{.*}}name = "._QFFfnEb1"{{.*}}flags = Artificial>
23+
// CHECK: #llvm.di_composite_type<tag = DW_TAG_array_type{{.*}}elements = #llvm.di_subrange<count = #llvm.di_expression<[{{.*}}]>, lowerBound = #[[VAR]], stride = #llvm.di_expression<[{{.*}}]>>, dataLocation = <[DW_OP_push_object_address, DW_OP_deref]>>

flang/test/Transforms/debug-assumed-size-array.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
1616
#loc1 = loc("test.f90":3:1)
1717
#loc2 = loc("test.f90":4:1)
1818

19-
// CHECK-DAG: #[[TY1:.*]] = #llvm.di_composite_type<tag = DW_TAG_array_type{{.*}}elements = #llvm.di_subrange<count = 5 : i64, lowerBound = 1 : i64>, #llvm.di_subrange<>>
19+
// CHECK-DAG: #[[TY1:.*]] = #llvm.di_composite_type<tag = DW_TAG_array_type{{.*}}elements = #llvm.di_subrange<count = 5 : i64>, #llvm.di_subrange<>>
2020
// CHECK-DAG: #[[TY2:.*]] = #llvm.di_composite_type<tag = DW_TAG_array_type{{.*}}elements = #llvm.di_subrange<lowerBound = 2 : i64>>
2121
// CHECK-DAG: #llvm.di_local_variable<{{.*}}name = "a1"{{.*}}type = #[[TY1]]>
2222
// CHECK-DAG: #llvm.di_local_variable<{{.*}}name = "a2"{{.*}}type = #[[TY2]]>

flang/test/Transforms/debug-fixed-array-type.fir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
3131

3232
// CHECK-DAG: #[[INT:.*]] = #llvm.di_basic_type<tag = DW_TAG_base_type, name = "integer", sizeInBits = 32, encoding = DW_ATE_signed>
3333
// CHECK-DAG: #[[REAL:.*]] = #llvm.di_basic_type<tag = DW_TAG_base_type, name = "real", sizeInBits = 32, encoding = DW_ATE_float>
34-
// CHECK-DAG: #[[D1TY:.*]] = #llvm.di_composite_type<tag = DW_TAG_array_type{{.*}}baseType = #[[INT]], elements = #llvm.di_subrange<count = 3 : i64, lowerBound = 1 : i64>>
35-
// CHECK-DAG: #[[D2TY:.*]] = #llvm.di_composite_type<tag = DW_TAG_array_type{{.*}}baseType = #[[INT]], elements = #llvm.di_subrange<count = 2 : i64, lowerBound = 1 : i64>, #llvm.di_subrange<count = 5 : i64, lowerBound = 1 : i64>>
36-
// CHECK-DAG: #[[D3TY:.*]] = #llvm.di_composite_type<tag = DW_TAG_array_type{{.*}}baseType = #[[REAL]], elements = #llvm.di_subrange<count = 6 : i64, lowerBound = 1 : i64>, #llvm.di_subrange<count = 8 : i64, lowerBound = 1 : i64>, #llvm.di_subrange<count = 7 : i64, lowerBound = 1 : i64>>
34+
// CHECK-DAG: #[[D1TY:.*]] = #llvm.di_composite_type<tag = DW_TAG_array_type{{.*}}baseType = #[[INT]], elements = #llvm.di_subrange<count = 3 : i64>>
35+
// CHECK-DAG: #[[D2TY:.*]] = #llvm.di_composite_type<tag = DW_TAG_array_type{{.*}}baseType = #[[INT]], elements = #llvm.di_subrange<count = 2 : i64>, #llvm.di_subrange<count = 5 : i64>>
36+
// CHECK-DAG: #[[D3TY:.*]] = #llvm.di_composite_type<tag = DW_TAG_array_type{{.*}}baseType = #[[REAL]], elements = #llvm.di_subrange<count = 6 : i64>, #llvm.di_subrange<count = 8 : i64>, #llvm.di_subrange<count = 7 : i64>>
3737
// CHECK-DAG: #[[D4TY:.*]] = #llvm.di_composite_type<tag = DW_TAG_array_type, baseType = #di_basic_type, elements = #llvm.di_subrange<count = 6 : i64, lowerBound = -2 : i64>, #llvm.di_subrange<count = 7 : i64, lowerBound = 4 : i64>>
3838
// CHECK-DAG: #llvm.di_local_variable<{{.*}}name = "d1"{{.*}}type = #[[D1TY]]>
3939
// CHECK-DAG: #llvm.di_local_variable<{{.*}}name = "d2"{{.*}}type = #[[D2TY]]>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s | FileCheck %s
2+
3+
module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
4+
func.func @foo_(%arg0: !fir.ref<!fir.array<?x?xi32>> {fir.bindc_name = "a"}, %arg1: !fir.ref<i32> {fir.bindc_name = "n"}, %arg2: !fir.ref<i32> {fir.bindc_name = "m"}, %arg3: !fir.ref<i32> {fir.bindc_name = "p"}) attributes {fir.internal_name = "_QPfoo"} {
5+
%c5_i32 = arith.constant 5 : i32
6+
%c6_i32 = arith.constant 6 : i32
7+
%c2 = arith.constant 2 : index
8+
%c10_i32 = arith.constant 10 : i32
9+
%c0 = arith.constant 0 : index
10+
%c1 = arith.constant 1 : index
11+
%0 = fir.undefined !fir.dscope
12+
%1 = fircg.ext_declare %arg1 dummy_scope %0 {uniq_name = "_QFfooEn"} : (!fir.ref<i32>, !fir.dscope) -> !fir.ref<i32> loc(#loc2)
13+
%2 = fircg.ext_declare %arg2 dummy_scope %0 {uniq_name = "_QFfooEm"} : (!fir.ref<i32>, !fir.dscope) -> !fir.ref<i32> loc(#loc3)
14+
%3 = fircg.ext_declare %arg3 dummy_scope %0 {uniq_name = "_QFfooEp"} : (!fir.ref<i32>, !fir.dscope) -> !fir.ref<i32> loc(#loc4)
15+
%4 = fir.load %1 : !fir.ref<i32>
16+
%5 = fir.convert %4 : (i32) -> index
17+
%6 = fir.load %2 : !fir.ref<i32>
18+
%7 = fir.convert %6 : (i32) -> index
19+
%8 = arith.subi %7, %5 : index
20+
%9 = arith.addi %8, %c1 : index
21+
%10 = arith.cmpi sgt, %9, %c0 : index
22+
%11 = arith.select %10, %9, %c0 : index
23+
%12 = fir.load %3 : !fir.ref<i32>
24+
%13 = fir.convert %12 : (i32) -> index
25+
%14 = arith.cmpi sgt, %13, %c0 : index
26+
%15 = arith.select %14, %13, %c0 : index
27+
%16 = fircg.ext_declare %arg0(%11, %15) origin %5, %c1 dummy_scope %0 {uniq_name = "_QFfooEa"} : (!fir.ref<!fir.array<?x?xi32>>, index, index, index, index, !fir.dscope) -> !fir.ref<!fir.array<?x?xi32>> loc(#loc5)
28+
return
29+
} loc(#loc1)
30+
}
31+
32+
#loc1 = loc("test.f90":5:1)
33+
#loc2 = loc("test.f90":6:11)
34+
#loc3 = loc("test.f90":7:11)
35+
#loc4 = loc("test.f90":2:8)
36+
#loc5 = loc("test.f90":8:11)
37+
38+
// CHECK-DAG: #[[VAR0:.*]] = #llvm.di_local_variable<{{.*}}name = "._QFfooEa3"{{.*}}flags = Artificial>
39+
// CHECK-DAG: #[[VAR1:.*]] = #llvm.di_local_variable<{{.*}}name = "._QFfooEa1"{{.*}}flags = Artificial>
40+
// CHECK-DAG: #[[VAR2:.*]] = #llvm.di_local_variable<{{.*}}name = "._QFfooEa2"{{.*}}flags = Artificial>
41+
// CHECK-DAG: #llvm.di_composite_type<tag = DW_TAG_array_type{{.*}}elements = #llvm.di_subrange<count = #[[VAR1]], lowerBound = #[[VAR0]]>, #llvm.di_subrange<count = #[[VAR2]]>>

flang/test/Transforms/debug-variable-char-len.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
2222
#loc2 = loc("test.f90":17:1)
2323
#loc3 = loc("test.f90":15:1)
2424

25-
// CHECK: #[[VAR:.*]] = #llvm.di_local_variable<{{.*}}name = "._QFfooEstr1"{{.*}}flags = Artificial>
25+
// CHECK: #[[VAR:.*]] = #llvm.di_local_variable<{{.*}}name = "._QFfooEstr1{{.*}}flags = Artificial>
2626
// CHECK: func.func @foo
2727
// CHECK: llvm.intr.dbg.value #[[VAR]]
2828
// CHECK: return

0 commit comments

Comments
 (0)