-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Expand file tree
/
Copy pathwsloop-unstructured.f90
More file actions
61 lines (56 loc) · 2.08 KB
/
wsloop-unstructured.f90
File metadata and controls
61 lines (56 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
! RUN: bbc -emit-hlfir -fopenmp -o - %s | FileCheck %s
subroutine sub(imax, jmax, x, y)
integer, intent(in) :: imax, jmax
real, intent(in), dimension(1:imax, 1:jmax) :: x, y
integer :: i, j, ii
! collapse(2) is needed to reproduce the issue
!$omp parallel do collapse(2)
do j = 1, jmax
do i = 1, imax
do ii = 1, imax ! note that this loop is not collapsed
if (x(i,j) < y(ii,j)) then
! exit needed to force unstructured control flow
exit
endif
enddo
enddo
enddo
end subroutine sub
! this is testing that we don't crash generating code for this: in particular
! that all blocks are terminated
! CHECK-LABEL: func.func @_QPsub(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i32> {fir.bindc_name = "imax"},
! CHECK-SAME: %[[VAL_1:.*]]: !fir.ref<i32> {fir.bindc_name = "jmax"},
! CHECK-SAME: %[[VAL_2:.*]]: !fir.ref<!fir.array<?x?xf32>> {fir.bindc_name = "x"},
! CHECK-SAME: %[[VAL_3:.*]]: !fir.ref<!fir.array<?x?xf32>> {fir.bindc_name = "y"}) {
! [...]
! CHECK: omp.wsloop for (%[[VAL_53:.*]], %[[VAL_54:.*]]) : i32 = ({{.*}}) to ({{.*}}) inclusive step ({{.*}}) {
! [...]
! CHECK: cf.br ^bb1
! CHECK: ^bb1:
! CHECK: cf.br ^bb2
! CHECK: ^bb2:
! [...]
! CHECK: cf.br ^bb3
! CHECK: ^bb3:
! [...]
! CHECK: %[[VAL_63:.*]] = arith.cmpi sgt, %{{.*}}, %{{.*}} : i32
! CHECK: cf.cond_br %[[VAL_63]], ^bb4, ^bb7
! CHECK: ^bb4:
! [...]
! CHECK: %[[VAL_76:.*]] = arith.cmpf olt, %{{.*}}, %{{.*}} fastmath<contract> : f32
! CHECK: cf.cond_br %[[VAL_76]], ^bb5, ^bb6
! CHECK: ^bb5:
! CHECK: cf.br ^bb7
! CHECK: ^bb6:
! [...]
! CHECK: cf.br ^bb3
! CHECK: ^bb7:
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: cf.br ^bb1
! CHECK: ^bb1:
! CHECK: return
! CHECK: }