Files
llvm-project/flang/test/Transforms/debug-module-3.fir
Abid Qadeer 6c40c76c21 [flang][debug] Avoid redundant module info. (#161542)
Fixes https://github.com/llvm/llvm-project/issues/160907.

When a module is just being used and not defined, we generate it with
decl=true. But if the file/line fields are valid, the module is not
merged with the original and is considered different. This patch avoids
setting file/line/scope in such cases.
2025-10-03 10:08:35 +01:00

14 lines
434 B
Plaintext

// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s | FileCheck %s
module {
func.func @_QQmain() {
%2 = fir.address_of(@_QMmodEvar1) : !fir.ref<i32> loc(#loc1)
%3 = fircg.ext_declare %2 {uniq_name = "_QMmodEvar1"} : (!fir.ref<i32>) -> !fir.ref<i32> loc(#loc1)
return
} loc(#loc1)
fir.global @_QMmodEvar1 : i32 loc(#loc1)
}
#loc1 = loc("test1.f90":1:0)
// CHECK: #llvm.di_module<name = "mod", isDecl = true>