| 1 |
! Test that hlfir.declare is not created again for dummy arguments |
| 2 |
! used in specifications of BLOCK variables. |
| 3 |
! RUN: bbc -emit-hlfir %s -o - | FileCheck %s |
| 4 |
|
| 5 |
subroutine test(n) |
| 6 |
integer(8) :: n |
| 7 |
call before_block() |
| 8 |
block |
| 9 |
real :: x(n) |
| 10 |
call foo(x) |
| 11 |
end block |
| 12 |
end subroutine |
| 13 |
! CHECK-LABEL: func.func @_QPtest( |
| 14 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i64> {fir.bindc_name = "n"}) { |
| 15 |
! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %{{[0-9]+}} {uniq_name = "_QFtestEn"} : (!fir.ref<i64>, !fir.dscope) -> (!fir.ref<i64>, !fir.ref<i64>) |
| 16 |
! CHECK: fir.call @_QPbefore_block() {{.*}}: () -> () |
| 17 |
! CHECK: %[[VAL_3:.*]] = fir.load %[[VAL_1]]#0 : !fir.ref<i64> |
| 18 |
! CHECK: %[[VAL_4:.*]] = fir.convert %[[VAL_3]] : (i64) -> index |
| 19 |
! CHECK: %[[VAL_5:.*]] = arith.constant 0 : index |
| 20 |
! CHECK: %[[VAL_6:.*]] = arith.cmpi sgt, %[[VAL_4]], %[[VAL_5]] : index |
| 21 |
! CHECK: %[[VAL_7:.*]] = arith.select %[[VAL_6]], %[[VAL_4]], %[[VAL_5]] : index |
| 22 |
! CHECK: %[[VAL_8:.*]] = fir.alloca !fir.array<?xf32>, %[[VAL_7]] {bindc_name = "x", uniq_name = "_QFtestB1Ex"} |
| 23 |
! CHECK: %[[VAL_9:.*]] = fir.shape %[[VAL_7]] : (index) -> !fir.shape<1> |
| 24 |
! CHECK: %[[VAL_10:.*]]:2 = hlfir.declare %[[VAL_8]](%[[VAL_9]]) {uniq_name = "_QFtestB1Ex"} : (!fir.ref<!fir.array<?xf32>>, !fir.shape<1>) -> (!fir.box<!fir.array<?xf32>>, !fir.ref<!fir.array<?xf32>>) |
| 25 |
! CHECK: fir.call @_QPfoo(%[[VAL_10]]#1) {{.*}}: (!fir.ref<!fir.array<?xf32>>) -> () |