64 lines · plain
1! RUN: bbc -emit-hlfir -fopenmp -o - %s | FileCheck %s2 3subroutine sub(imax, jmax, x, y)4 integer, intent(in) :: imax, jmax5 real, intent(in), dimension(1:imax, 1:jmax) :: x, y6 7 integer :: i, j, ii8 9 ! collapse(2) is needed to reproduce the issue10 !$omp parallel do collapse(2)11 do j = 1, jmax12 do i = 1, imax13 do ii = 1, imax ! note that this loop is not collapsed14 if (x(i,j) < y(ii,j)) then15 ! exit needed to force unstructured control flow16 exit17 endif18 enddo19 enddo20 enddo21end subroutine sub22 23! this is testing that we don't crash generating code for this: in particular24! that all blocks are terminated25 26! CHECK-LABEL: func.func @_QPsub(27! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i32> {fir.bindc_name = "imax"},28! CHECK-SAME: %[[VAL_1:.*]]: !fir.ref<i32> {fir.bindc_name = "jmax"},29! CHECK-SAME: %[[VAL_2:.*]]: !fir.ref<!fir.array<?x?xf32>> {fir.bindc_name = "x"},30! CHECK-SAME: %[[VAL_3:.*]]: !fir.ref<!fir.array<?x?xf32>> {fir.bindc_name = "y"}) {31! [...]32! CHECK: omp.wsloop private({{.*}}) {33! CHECK-NEXT: omp.loop_nest (%[[VAL_53:.*]], %[[VAL_54:.*]]) : i32 = ({{.*}}) to ({{.*}}) inclusive step ({{.*}}) {34! [...]35! CHECK: cf.br ^bb136! CHECK: ^bb1:37! CHECK: cf.br ^bb238! CHECK: ^bb2:39! [...]40! CHECK: cf.br ^bb341! CHECK: ^bb3:42! [...]43! CHECK: %[[VAL_63:.*]] = arith.cmpi sgt, %{{.*}}, %{{.*}} : i3244! CHECK: cf.cond_br %[[VAL_63]], ^bb4, ^bb745! CHECK: ^bb4:46! [...]47! CHECK: %[[VAL_76:.*]] = arith.cmpf olt, %{{.*}}, %{{.*}} fastmath<contract> : f3248! CHECK: cf.cond_br %[[VAL_76]], ^bb5, ^bb649! CHECK: ^bb5:50! CHECK: cf.br ^bb751! CHECK: ^bb6:52! [...]53! CHECK: cf.br ^bb354! CHECK: ^bb7:55! CHECK: omp.yield56! CHECK: }57! CHECK: }58! CHECK: omp.terminator59! CHECK: }60! CHECK: cf.br ^bb161! CHECK: ^bb1:62! CHECK: return63! CHECK: }64