@@ -61,3 +61,40 @@ subroutine takes_assumed_rank_t(x)
61
61
! CHECK: fir.call @_QPtakes_assumed_rank_t(%[[VAL_3]]) fastmath<contract> : (!fir.box<!fir.array<*:!fir.type<_QFtest_poly_to_nonepolyTt{i:i32}>>>) -> ()
62
62
! CHECK: return
63
63
! CHECK: }
64
+
65
+
66
+ subroutine test_copy_in_out (x )
67
+ real :: x(..)
68
+ interface
69
+ subroutine takes_contiguous (x )
70
+ real , contiguous :: x(..)
71
+ end subroutine
72
+ end interface
73
+ call takes_contiguous(x)
74
+ end subroutine
75
+ ! CHECK-LABEL: func.func @_QPtest_copy_in_out(
76
+ ! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<*:f32>> {fir.bindc_name = "x"}) {
77
+ ! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<*:f32>>>
78
+ ! CHECK: %[[VAL_2:.*]] = fir.dummy_scope : !fir.dscope
79
+ ! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %[[VAL_2]] {uniq_name = "_QFtest_copy_in_outEx"} : (!fir.box<!fir.array<*:f32>>, !fir.dscope) -> (!fir.box<!fir.array<*:f32>>, !fir.box<!fir.array<*:f32>>)
80
+ ! CHECK: %[[VAL_4:.*]]:2 = hlfir.copy_in %[[VAL_3]]#0 to %[[VAL_1]] : (!fir.box<!fir.array<*:f32>>, !fir.ref<!fir.box<!fir.heap<!fir.array<*:f32>>>>) -> (!fir.box<!fir.array<*:f32>>, i1)
81
+ ! CHECK: fir.call @_QPtakes_contiguous(%[[VAL_4]]#0) fastmath<contract> : (!fir.box<!fir.array<*:f32>>) -> ()
82
+ ! CHECK: hlfir.copy_out %[[VAL_1]], %[[VAL_4]]#1 to %[[VAL_3]]#0 : (!fir.ref<!fir.box<!fir.heap<!fir.array<*:f32>>>>, i1, !fir.box<!fir.array<*:f32>>) -> ()
83
+
84
+ subroutine test_copy_in_out_2 (x )
85
+ real :: x(..)
86
+ interface
87
+ subroutine takes_contiguous_intentin (x )
88
+ real , intent (in ), contiguous :: x(..)
89
+ end subroutine
90
+ end interface
91
+ call takes_contiguous_intentin(x)
92
+ end subroutine
93
+ ! CHECK-LABEL: func.func @_QPtest_copy_in_out_2(
94
+ ! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<*:f32>> {fir.bindc_name = "x"}) {
95
+ ! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<*:f32>>>
96
+ ! CHECK: %[[VAL_2:.*]] = fir.dummy_scope : !fir.dscope
97
+ ! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %[[VAL_2]] {uniq_name = "_QFtest_copy_in_out_2Ex"} : (!fir.box<!fir.array<*:f32>>, !fir.dscope) -> (!fir.box<!fir.array<*:f32>>, !fir.box<!fir.array<*:f32>>)
98
+ ! CHECK: %[[VAL_4:.*]]:2 = hlfir.copy_in %[[VAL_3]]#0 to %[[VAL_1]] : (!fir.box<!fir.array<*:f32>>, !fir.ref<!fir.box<!fir.heap<!fir.array<*:f32>>>>) -> (!fir.box<!fir.array<*:f32>>, i1)
99
+ ! CHECK: fir.call @_QPtakes_contiguous_intentin(%[[VAL_4]]#0) fastmath<contract> : (!fir.box<!fir.array<*:f32>>) -> ()
100
+ ! CHECK: hlfir.copy_out %[[VAL_1]], %[[VAL_4]]#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<*:f32>>>>, i1) -> ()
0 commit comments