llvm-project/flang/test/Lower/forall/forall-construct-4.f90
jeanPerier f35f863a88
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957)
Patch 2/3 of the transition step 1 described in

https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7.

All the modified tests are still here since coverage for the direct
lowering to FIR was still needed while it was default. Some already have
an HLFIR version, some have not and will need to be ported in step 2
described in the RFC.

Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do
not need a flag since the HLFIR/no HLFIR output is the same for what is
being tested.
2023-11-13 09:14:05 +01:00

47 lines
1.2 KiB
Fortran

! Test forall lowering
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
!*** Test forall targeted by label
subroutine test4_forall_construct()
integer :: a(2) = 1
100 forall (i=1:2)
a(i) = a(i) + 1
end forall
if (a(1) > 3) goto 200
goto 100
200 return
end subroutine test4_forall_construct
! CHECK-LABEL: func @_QPtest4_forall_construct
! CHECK: cf.br ^bb1
! CHECK: ^bb1: // 2 preds: ^bb0, ^bb2
! CHECK: %{{.*}} = fir.do_loop
! CHECK: cf.cond_br %{{.*}}, ^bb2, ^bb3
! CHECK: ^bb2: // pred: ^bb1
! CHECK: cf.br ^bb1
! CHECK: ^bb3: // pred: ^bb1
! CHECK: cf.br ^bb4
! CHECK: ^bb4: // pred: ^bb3
! CHECK: return
subroutine test4_forall_construct2()
integer :: a(2) = 1
100 forall (i=1:2) a(i) = a(i) + 1
if (a(1) > 3) goto 200
goto 100
200 return
end subroutine test4_forall_construct2
! CHECK-LABEL: func @_QPtest4_forall_construct2
! CHECK: cf.br ^bb1
! CHECK: ^bb1: // 2 preds: ^bb0, ^bb2
! CHECK: %{{.*}} = fir.do_loop
! CHECK: cf.cond_br %{{.*}}, ^bb2, ^bb3
! CHECK: ^bb2: // pred: ^bb1
! CHECK: cf.br ^bb1
! CHECK: ^bb3: // pred: ^bb1
! CHECK: cf.br ^bb4
! CHECK: ^bb4: // pred: ^bb3
! CHECK: return