llvm-project/flang/test/Lower/irreducible.f90
Valentin Clement 3348c08359
[flang] Add lowering tests
Add lowering tests left behind during the upstreaming.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D128721

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-06-28 15:22:21 +02:00

25 lines
721 B
Fortran

! RUN: bbc %s -o "-" | FileCheck %s
! CHECK-LABEL: irreducible
subroutine irreducible(k)
! CHECK: cond_br %{{[0-9]+}}, ^bb1, ^bb2
if (k < 5) goto 20
! CHECK: ^bb1: // 2 preds: ^bb0, ^bb2
10 print*, k ! scc entry #1: (k < 5) is false
k = k + 1
! CHECK: ^bb2: // 2 preds: ^bb0, ^bb1
! CHECK: cond_br %{{[0-9]+}}, ^bb1, ^bb3
20 if (k < 3) goto 10 ! scc entry #2: (k < 5) is true
! CHECK: ^bb3: // pred: ^bb2
end
! CHECK-LABEL: main
program p
do i = 0, 6
n = i
print*
print*, 1000 + n
call irreducible(n)
enddo
end