Skip to content

Commit 8239ea3

Browse files
authored
[flang][debug] Support IndexType. (llvm#113921)
1 parent c0cba25 commit 8239ea3

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,10 @@ DebugTypeGenerator::convertType(mlir::Type Ty, mlir::LLVM::DIFileAttr fileAttr,
581581
/*genAssociated=*/false);
582582
} else if (auto vecTy = mlir::dyn_cast_or_null<fir::VectorType>(Ty)) {
583583
return convertVectorType(vecTy, fileAttr, scope, declOp);
584+
} else if (mlir::isa<mlir::IndexType>(Ty)) {
585+
return genBasicType(context, mlir::StringAttr::get(context, "integer"),
586+
llvmTypeConverter.getIndexTypeBitwidth(),
587+
llvm::dwarf::DW_ATE_signed);
584588
} else if (auto boxTy = mlir::dyn_cast_or_null<fir::BoxType>(Ty)) {
585589
auto elTy = boxTy.getElementType();
586590
if (auto seqTy = mlir::dyn_cast_or_null<fir::SequenceType>(elTy))
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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 private @str(%arg0: index) -> i32 loc(#loc1)
5+
}
6+
#loc1 = loc("test.f90":5:1)
7+
8+
// CHECK: #[[INT32_TY:.*]] = #llvm.di_basic_type<tag = DW_TAG_base_type, name = "integer", sizeInBits = 32, encoding = DW_ATE_signed>
9+
// CHECK: #[[INT64_TY:.*]] = #llvm.di_basic_type<tag = DW_TAG_base_type, name = "integer", sizeInBits = 64, encoding = DW_ATE_signed>
10+
// CHECK: #llvm.di_subroutine_type<{{.*}}types = #[[INT32_TY]], #[[INT64_TY]]>

0 commit comments

Comments
 (0)