Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions flang/lib/Lower/OpenMP/OpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1773,11 +1773,11 @@ static void genTaskloopClauses(lower::AbstractConverter &converter,
cp.processGrainsize(stmtCtx, clauseOps);
cp.processNumTasks(stmtCtx, clauseOps);

cp.processTODO<clause::Allocate, clause::Collapse, clause::Default,
clause::Final, clause::If, clause::InReduction,
clause::Lastprivate, clause::Mergeable, clause::Nogroup,
clause::Priority, clause::Reduction, clause::Shared,
clause::Untied>(loc, llvm::omp::Directive::OMPD_taskloop);
cp.processTODO<clause::Allocate, clause::Default, clause::Final, clause::If,
clause::InReduction, clause::Lastprivate, clause::Mergeable,
clause::Nogroup, clause::Priority, clause::Reduction,
clause::Shared, clause::Untied>(
loc, llvm::omp::Directive::OMPD_taskloop);
}

static void genTaskwaitClauses(lower::AbstractConverter &converter,
Expand Down
34 changes: 34 additions & 0 deletions flang/test/Lower/OpenMP/taskloop-collapse.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
! Test the collapse clause when being used with the taskloop construct
! RUN: bbc -emit-hlfir -fopenmp -fopenmp-version=45 %s -o - 2>&1 | FileCheck %s
! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=45 %s -o - 2>&1 | FileCheck %s

! CHECK-LABEL: omp.private
! CHECK-SAME: {type = private} @[[J_PRIVATE:.*]] : i32
! CHECK-LABEL: omp.private
! CHECK-SAME: {type = private} @[[I_PRIVATE:.*]] : i32
! CHECK-LABEL: omp.private
! CHECK-SAME: {type = firstprivate} @[[SUM_FIRSTPRIVATE:.*]] : i32 copy

! CHECK-LABEL: func.func @_QPtest()
! CHECK: %[[ALLOCA_I:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFtestEi"}
! CHECK: %[[DECLARE_I:.*]]:2 = hlfir.declare %1 {uniq_name = "_QFtestEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
! CHECK: %[[ALLOCA_J:.*]] = fir.alloca i32 {bindc_name = "j", uniq_name = "_QFtestEj"}
! CHECK: %[[DECLARE_J:.*]]:2 = hlfir.declare %3 {uniq_name = "_QFtestEj"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
! CHECK: %[[ALLOCA_SUM:.*]] = fir.alloca i32 {bindc_name = "sum", uniq_name = "_QFtestEsum"}
! CHECK: %[[DECLARE_SUM:.*]]:2 = hlfir.declare %5 {uniq_name = "_QFtestEsum"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)

subroutine test()
integer :: i, j, sum

!$omp taskloop collapse(2)
! CHECK-LABEL: omp.taskloop
! CHECK-SAME: private(@_QFtestEsum_firstprivate_i32 %[[DECLARE_SUM]]#0 -> %arg0, @_QFtestEi_private_i32 %[[DECLARE_I]]#0 -> %arg1, @_QFtestEj_private_i32 %[[DECLARE_J]]#0 -> %arg2 : !fir.ref<i32>, !fir.ref<i32>, !fir.ref<i32>)
! CHECK-LABEL: omp.loop_nest
! CHECK-SAME: (%arg3, %arg4) : i32 = (%c1_i32, %c1_i32_1) to (%c10_i32, %c5_i32) inclusive step (%c1_i32_0, %c1_i32_2) collapse(2)
do i = 1, 10
do j = 1, 5
sum = sum + i + j
end do
end do
!$omp end taskloop
end subroutine
15 changes: 15 additions & 0 deletions flang/test/Semantics/OpenMP/taskloop04.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
! When lowering Taskloop, it is possible for the TileSizes clause to be lowered, but this is not a supported clause.
! We should make sure that any use of Tilesizes with Taskloop is correctly rejected by the Semantics.
! RUN: %python %S/../test_errors.py %s %flang -fopenmp

subroutine test
integer :: i, sum

!ERROR: TILE cannot follow TASKLOOP
!ERROR: SIZES clause is not allowed on the TASKLOOP directive
!$omp taskloop tile sizes(2)
do i=1,10
sum = sum + i
end do
!$omp end taskloop
end subroutine