Skip to content

Commit 0edb5c3

Browse files
Revert "[flang] Improve debug info for functions." (#90444)
Reverts #90083 due to a test suite failure: https://lab.llvm.org/buildbot/#/builders/184/builds/11961 ``` flang-new: ../llvm/mlir/lib/IR/Types.cpp:126: unsigned int mlir::Type::getIntOrFloatBitWidth() const: Assertion `isIntOrFloat() && "only integers and floats have a bitwidth"' failed. ```
1 parent bf57d2e commit 0edb5c3

File tree

6 files changed

+11
-174
lines changed

6 files changed

+11
-174
lines changed

flang/lib/Optimizer/Transforms/AddDebugInfo.cpp

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
/// This pass populates some debug information for the module and functions.
1212
//===----------------------------------------------------------------------===//
1313

14-
#include "DebugTypeGenerator.h"
1514
#include "flang/Common/Version.h"
1615
#include "flang/Optimizer/Builder/FIRBuilder.h"
1716
#include "flang/Optimizer/Builder/Todo.h"
@@ -107,27 +106,14 @@ void AddDebugInfoPass::runOnOperation() {
107106
filePath = llvm::sys::path::parent_path(funcLoc.getFilename().getValue());
108107
}
109108

110-
mlir::StringAttr fullName =
111-
mlir::StringAttr::get(context, funcOp.getName());
112-
auto result = fir::NameUniquer::deconstruct(funcOp.getName());
113109
mlir::StringAttr funcName =
114-
mlir::StringAttr::get(context, result.second.name);
115-
116-
llvm::SmallVector<mlir::LLVM::DITypeAttr> types;
117-
fir::DebugTypeGenerator typeGen(module);
118-
for (auto resTy : funcOp.getResultTypes()) {
119-
auto tyAttr =
120-
typeGen.convertType(resTy, fileAttr, cuAttr, funcOp.getLoc());
121-
types.push_back(tyAttr);
122-
}
123-
for (auto inTy : funcOp.getArgumentTypes()) {
124-
auto tyAttr = typeGen.convertType(fir::unwrapRefType(inTy), fileAttr,
125-
cuAttr, funcOp.getLoc());
126-
types.push_back(tyAttr);
127-
}
128-
110+
mlir::StringAttr::get(context, funcOp.getName());
111+
mlir::LLVM::DIBasicTypeAttr bT = mlir::LLVM::DIBasicTypeAttr::get(
112+
context, llvm::dwarf::DW_TAG_base_type, "void", /*sizeInBits=*/0,
113+
/*encoding=*/1);
114+
// FIXME: Provide proper type for subroutine
129115
mlir::LLVM::DISubroutineTypeAttr subTypeAttr =
130-
mlir::LLVM::DISubroutineTypeAttr::get(context, CC, types);
116+
mlir::LLVM::DISubroutineTypeAttr::get(context, CC, {bT, bT});
131117
mlir::LLVM::DIFileAttr funcFileAttr =
132118
mlir::LLVM::DIFileAttr::get(context, fileName, filePath);
133119

@@ -144,13 +130,11 @@ void AddDebugInfoPass::runOnOperation() {
144130
subprogramFlags =
145131
subprogramFlags | mlir::LLVM::DISubprogramFlags::Definition;
146132
}
147-
unsigned line = 1;
148-
if (auto funcLoc = l.dyn_cast<mlir::FileLineColLoc>())
149-
line = funcLoc.getLine();
150-
133+
// FIXME: Provide proper line and scopeline.
151134
auto spAttr = mlir::LLVM::DISubprogramAttr::get(
152-
context, id, compilationUnit, fileAttr, funcName, fullName,
153-
funcFileAttr, line, line, subprogramFlags, subTypeAttr);
135+
context, id, compilationUnit, fileAttr, funcName, funcName,
136+
funcFileAttr, /*line=*/1, /*scopeline=*/1, subprogramFlags,
137+
subTypeAttr);
154138
funcOp->setLoc(builder.getFusedLoc({funcOp->getLoc()}, spAttr));
155139
});
156140
}

flang/lib/Optimizer/Transforms/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ add_flang_library(FIRTransforms
2222
OMPMarkDeclareTarget.cpp
2323
VScaleAttr.cpp
2424
FunctionAttr.cpp
25-
DebugTypeGenerator.cpp
2625

2726
DEPENDS
2827
FIRDialect

flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp

Lines changed: 0 additions & 63 deletions
This file was deleted.

flang/lib/Optimizer/Transforms/DebugTypeGenerator.h

Lines changed: 0 additions & 40 deletions
This file was deleted.

flang/test/Transforms/debug-fn-info.f90

Lines changed: 0 additions & 43 deletions
This file was deleted.

flang/test/Transforms/debug-line-table-inc-file.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module attributes {} {
3131
// CHECK: #[[LOC_INC_FILE:.*]] = loc("{{.*}}inc.f90":1:1)
3232
// CHECK: #[[LOC_FILE:.*]] = loc("{{.*}}simple.f90":3:1)
3333
// CHECK: #[[DI_CU:.*]] = #llvm.di_compile_unit<id = distinct[{{.*}}]<>, sourceLanguage = DW_LANG_Fortran95, file = #[[DI_FILE]], producer = "flang{{.*}}", isOptimized = false, emissionKind = LineTablesOnly>
34-
// CHECK: #[[DI_SP_INC:.*]] = #llvm.di_subprogram<id = distinct[{{.*}}]<>, compileUnit = #[[DI_CU]], scope = #[[DI_FILE]], name = "sinc", linkageName = "_QPsinc", file = #[[DI_INC_FILE]], {{.*}}>
34+
// CHECK: #[[DI_SP_INC:.*]] = #llvm.di_subprogram<id = distinct[{{.*}}]<>, compileUnit = #[[DI_CU]], scope = #[[DI_FILE]], name = "_QPsinc", linkageName = "_QPsinc", file = #[[DI_INC_FILE]], {{.*}}>
3535
// CHECK: #[[DI_SP:.*]] = #llvm.di_subprogram<id = distinct[{{.*}}]<>, compileUnit = #[[DI_CU]], scope = #[[DI_FILE]], name = "_QQmain", linkageName = "_QQmain", file = #[[DI_FILE]], {{.*}}>
3636
// CHECK: #[[FUSED_LOC_INC_FILE]] = loc(fused<#[[DI_SP_INC]]>[#[[LOC_INC_FILE]]])
3737
// CHECK: #[[FUSED_LOC_FILE]] = loc(fused<#[[DI_SP]]>[#[[LOC_FILE]]])

0 commit comments

Comments
 (0)