Skip to content

Commit 69e7cb5

Browse files
authored
[flang] Add a test for fir.real debug conversion. (#90726)
This is an accompanying test for the fix done in #90683. It checks that fir.real conversion works ok. The failing fortran source in the #90683 generates fir.real type in the target-rewrite pass which caused the original issue.
1 parent d9fc5ba commit 69e7cb5

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

flang/test/Transforms/debug-90683.fir

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s -o - | FileCheck %s
2+
3+
// This test checks that debug information for fir.real type works ok.
4+
5+
module attributes {} {
6+
func.func @_QPfn1(%arg0: !fir.ref<!fir.complex<8>> {fir.bindc_name = "a"} ) {
7+
%0 = fir.declare %arg0 {uniq_name = "_QFfn1Ea"} : (!fir.ref<!fir.complex<8>>) -> !fir.ref<!fir.complex<8>>
8+
%1 = fir.alloca f32 {bindc_name = "abserror", uniq_name = "_QFfn1Eabserror"}
9+
%2 = fir.declare %1 {uniq_name = "_QFfn1Eabserror"} : (!fir.ref<f32>) -> !fir.ref<f32>
10+
%3 = fir.load %0 : !fir.ref<!fir.complex<8>>
11+
%4 = fir.extract_value %3, [0 : i32] : (!fir.complex<8>) -> !fir.real<8>
12+
%5 = fir.extract_value %3, [1 : i32] : (!fir.complex<8>) -> !fir.real<8>
13+
%6 = fir.call @cabs(%4, %5) : (!fir.real<8>, !fir.real<8>) -> f64
14+
%7 = fir.convert %6 : (f64) -> f32
15+
fir.store %7 to %2 : !fir.ref<f32>
16+
return
17+
} loc(#loc1)
18+
func.func private @cabs(!fir.real<8>, !fir.real<8>) -> f64 attributes {fir.bindc_name = "cabs", fir.runtime}
19+
} loc(#loc)
20+
#loc1 = loc("test.f90":5:1)
21+
#loc = loc("test.f90":0:0)
22+
23+
// CHECK-DAG: #[[TY:.*]] = #llvm.di_basic_type<tag = DW_TAG_base_type, name = "real", sizeInBits = 64, encoding = DW_ATE_float>
24+
// CHECK-DAG: #[[TY1:.*]] = #llvm.di_subroutine_type<callingConvention = DW_CC_normal, types = #[[TY]], #[[TY]], #[[TY]]>
25+
// CHECK-DAG: #{{.*}} = #llvm.di_subprogram<scope = #{{.*}}, name = "cabs", linkageName = "cabs", file = #{{.*}}, line = {{.*}}, scopeLine = {{.*}}, type = #[[TY1]]>

0 commit comments

Comments
 (0)