Skip to content

Commit 4923cff

Browse files
authored
[Flang] Add missing dependency to AddDebugInfo pass (#139099)
The `AddDebugInfo` pass currently has a dependency on the `DLTI` MLIR dialect caused by a call to the `fir::support::getOrSetMLIRDataLayout()` utility function. This dependency is not captured in the pass definition. This patch adds the dependency and simplifies several unit tests that had to explicitly use the `DLTI` dialect to prevent the missing dependency from causing compiler failures.
1 parent 187a83f commit 4923cff

30 files changed

+31
-29
lines changed

flang/include/flang/Optimizer/Transforms/Passes.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ def AddDebugInfo : Pass<"add-debug-info", "mlir::ModuleOp"> {
210210
}];
211211
let constructor = "::fir::createAddDebugInfoPass()";
212212
let dependentDialects = [
213-
"fir::FIROpsDialect", "mlir::func::FuncDialect", "mlir::LLVM::LLVMDialect"
213+
"fir::FIROpsDialect", "mlir::func::FuncDialect", "mlir::LLVM::LLVMDialect",
214+
"mlir::DLTIDialect"
214215
];
215216
let options = [
216217
Option<"debugLevel", "debug-level",

flang/lib/Optimizer/Transforms/AddDebugInfo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "flang/Optimizer/Support/InternalNames.h"
2424
#include "flang/Optimizer/Transforms/Passes.h"
2525
#include "flang/Support/Version.h"
26+
#include "mlir/Dialect/DLTI/DLTI.h"
2627
#include "mlir/Dialect/Func/IR/FuncOps.h"
2728
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
2829
#include "mlir/IR/Matchers.h"

flang/test/Transforms/debug-107988.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s -o - | FileCheck %s
22

3-
module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
3+
module {
44
func.func @test(%arg0: !fir.ref<!fir.char<1,?>> {fir.bindc_name = "str"}, %arg1: i64) {
55
%0 = fir.emboxchar %arg0, %arg1 : (!fir.ref<!fir.char<1,?>>, i64) -> !fir.boxchar<1>
66
%1 = fir.undefined !fir.dscope

flang/test/Transforms/debug-96314.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s -o - | FileCheck %s
22

3-
module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
3+
module {
44
func.func @_QMhelperPmod_sub(%arg0: !fir.ref<i32> {fir.bindc_name = "a"} ) {
55
return
66
} loc(#loc1)

flang/test/Transforms/debug-allocatable-1.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s | FileCheck %s
22

33

4-
module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
4+
module {
55
func.func private @_QFPff() {
66
%c1 = arith.constant 1 : index
77
%c0 = arith.constant 0 : index

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s | FileCheck %s
22

3-
module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
3+
module {
44
func.func @_QFPfn(%arg0: !fir.box<!fir.array<*:i32>> ) {
55
%1 = fir.undefined !fir.dscope
66
%2 = fircg.ext_declare %arg0 dummy_scope %1 {uniq_name = "_QFFfnEx"} : (!fir.box<!fir.array<*:i32>>, !fir.dscope) -> !fir.box<!fir.array<*:i32>> loc(#loc2)

flang/test/Transforms/debug-assumed-shape-array-2.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Test assumed shape array with variable lower bound.
44

5-
module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
5+
module {
66
func.func private @_QFPfn(%arg0: !fir.box<!fir.array<?xi32>> {fir.bindc_name = "b"}, %arg1: !fir.ref<i32> {fir.bindc_name = "n"}) attributes {} {
77
%c23_i32 = arith.constant 23 : i32
88
%c6_i32 = arith.constant 6 : i32

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s | FileCheck %s
22

3-
module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
3+
module {
44
func.func @_QMhelperPfn(%arg0: !fir.ref<!fir.array<5x?xi32>> {fir.bindc_name = "a1"}, %arg1: !fir.ref<!fir.array<?xi32>> {fir.bindc_name = "a2"}, %arg2: !fir.ref<!fir.array<2x?xi32>> {fir.bindc_name = "a3"}) {
55
%c5 = arith.constant 5 : index
66
%c1 = arith.constant 1 : index

flang/test/Transforms/debug-char-type-1.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s | FileCheck %s
22

3-
module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
3+
module {
44
fir.global @_QMhelperEstr1 : !fir.char<1,40> {
55
%0 = fir.zero_bits !fir.char<1,40>
66
fir.has_value %0 : !fir.char<1,40>

flang/test/Transforms/debug-class-type.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s | FileCheck %s
22

3-
module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
3+
module {
44
fir.type_info @_QTtest_type nofinal : !fir.type<_QTtest_type{a:i32,b:!fir.box<!fir.heap<!fir.array<?x?xf32>>>}> dispatch_table {
55
fir.dt_entry "test_proc", @_QPtest_proc
66
} loc(#loc1)

0 commit comments

Comments
 (0)