[DebugInfo][RemoveDIs] Emulate inserting insts in dbg.value sequences (#73350)
[llvm-project.git] / flang / test / Lower / basic-call.f90
blobc1a9de3f728217ebcca19781d3a397f09251d651
1 ! RUN: bbc %s -o "-" -emit-fir -hlfir=false | FileCheck %s
3 subroutine sub1()
4 end
5 ! CHECK-LABEL: func @_QPsub1()
7 subroutine sub2()
8 call sub1()
9 end
11 ! CHECK-LABEL: func @_QPsub2()
12 ! CHECK: fir.call @_QPsub1() {{.*}}: () -> ()
14 subroutine sub3(a, b)
15 integer :: a
16 real :: b
17 end
19 ! CHECK-LABEL: func @_QPsub3(
20 ! CHECK-SAME: %{{.*}}: !fir.ref<i32> {fir.bindc_name = "a"},
21 ! CHECK-SAME: %{{.*}}: !fir.ref<f32> {fir.bindc_name = "b"})
23 subroutine sub4()
24 call sub3(2, 3.0)
25 end
27 ! CHECK-LABEL: func @_QPsub4() {
28 ! CHECK-DAG: %[[REAL_VALUE:.*]] = fir.alloca f32 {adapt.valuebyref}
29 ! CHECK-DAG: %[[INT_VALUE:.*]] = fir.alloca i32 {adapt.valuebyref}
30 ! CHECK: %[[C2:.*]] = arith.constant 2 : i32
31 ! CHECK: fir.store %[[C2]] to %[[INT_VALUE]] : !fir.ref<i32>
32 ! CHECK: %[[C3:.*]] = arith.constant 3.000000e+00 : f32
33 ! CHECK: fir.store %[[C3]] to %[[REAL_VALUE]] : !fir.ref<f32>
34 ! CHECK: fir.call @_QPsub3(%[[INT_VALUE]], %[[REAL_VALUE]]) {{.*}}: (!fir.ref<i32>, !fir.ref<f32>) -> ()
36 subroutine call_fct1()
37 real :: a, b, c
38 c = fct1(a, b)
39 end
41 ! CHECK-LABEL: func @_QPcall_fct1()
42 ! CHECK: %[[A:.*]] = fir.alloca f32 {bindc_name = "a", uniq_name = "_QFcall_fct1Ea"}
43 ! CHECK: %[[B:.*]] = fir.alloca f32 {bindc_name = "b", uniq_name = "_QFcall_fct1Eb"}
44 ! CHECK: %[[C:.*]] = fir.alloca f32 {bindc_name = "c", uniq_name = "_QFcall_fct1Ec"}
45 ! CHECK: %[[RES:.*]] = fir.call @_QPfct1(%[[A]], %[[B]]) {{.*}}: (!fir.ref<f32>, !fir.ref<f32>) -> f32
46 ! CHECK: fir.store %[[RES]] to %[[C]] : !fir.ref<f32>
47 ! CHECK: return
49 ! CHECK: func private @_QPfct1(!fir.ref<f32>, !fir.ref<f32>) -> f32