aboutsummaryrefslogtreecommitdiff
path: root/flang/test
diff options
context:
space:
mode:
Diffstat (limited to 'flang/test')
-rw-r--r--flang/test/CMakeLists.txt3
-rw-r--r--flang/test/Examples/omp-atomic.f906
-rw-r--r--flang/test/Examples/omp-sections.f904
-rw-r--r--flang/test/Fir/FirToSCF/if.fir57
-rw-r--r--flang/test/Lower/Intrinsics/c_f_pointer.f9075
-rw-r--r--flang/test/Lower/OpenACC/Todo/do-loops-to-acc-loops-todo.f9091
-rw-r--r--flang/test/Lower/OpenACC/acc-atomic-capture.f9028
-rw-r--r--flang/test/Lower/OpenACC/do-loops-to-acc-loops.f90267
-rw-r--r--flang/test/Lower/OpenMP/atomic-control-options.f908
-rw-r--r--flang/test/Lower/OpenMP/distribute-simd.f9021
-rw-r--r--flang/test/Lower/OpenMP/optional-argument-map-3.f9046
-rw-r--r--flang/test/Lower/OpenMP/unroll-heuristic01.f9063
-rw-r--r--flang/test/Lower/OpenMP/unroll-heuristic02.f9098
-rw-r--r--flang/test/Lower/OpenMP/unroll-heuristic03.f9061
-rw-r--r--flang/test/Lower/OpenMP/wsloop-simd.f9021
-rw-r--r--flang/test/Lower/parametrized-derived-types.f9019
-rw-r--r--flang/test/NonGtestUnit/lit.cfg.py2
-rw-r--r--flang/test/Parser/OpenMP/affinity-clause.f9012
-rw-r--r--flang/test/Parser/OpenMP/allocators-unparse.f908
-rw-r--r--flang/test/Parser/OpenMP/atomic-compare.f9018
-rw-r--r--flang/test/Parser/OpenMP/atomic-end.f908
-rw-r--r--flang/test/Parser/OpenMP/block-construct.f9020
-rw-r--r--flang/test/Parser/OpenMP/construct-prefix-conflict.f9040
-rw-r--r--flang/test/Parser/OpenMP/declare-target-indirect-tree.f906
-rw-r--r--flang/test/Parser/OpenMP/defaultmap-clause.f9024
-rw-r--r--flang/test/Parser/OpenMP/defaultmap-unparse.f9036
-rw-r--r--flang/test/Parser/OpenMP/dispatch.f908
-rw-r--r--flang/test/Parser/OpenMP/enter-automap-modifier.f9016
-rw-r--r--flang/test/Parser/OpenMP/if-clause.f904
-rw-r--r--flang/test/Parser/OpenMP/in-reduction-clause.f9012
-rw-r--r--flang/test/Parser/OpenMP/map-modifiers-v60.f9020
-rw-r--r--flang/test/Parser/OpenMP/map-modifiers.f9046
-rw-r--r--flang/test/Parser/OpenMP/masked-unparse.f9012
-rw-r--r--flang/test/Parser/OpenMP/master-unparse.f908
-rw-r--r--flang/test/Parser/OpenMP/openmp6-directive-spellings.f9012
-rw-r--r--flang/test/Parser/OpenMP/proc-bind.f904
-rw-r--r--flang/test/Parser/OpenMP/scope.f908
-rw-r--r--flang/test/Parser/OpenMP/sections.f90144
-rw-r--r--flang/test/Parser/OpenMP/target_device_parse.f9064
-rw-r--r--flang/test/Parser/OpenMP/task-reduction-clause.f904
-rw-r--r--flang/test/Parser/OpenMP/task.f902
-rw-r--r--flang/test/Semantics/OpenACC/acc-atomic-validity.f9069
-rw-r--r--flang/test/Semantics/OpenACC/acc-default-none-function.f9020
-rw-r--r--flang/test/Semantics/OpenMP/atomic04.f902
-rw-r--r--flang/test/Semantics/OpenMP/atomic05.f902
-rw-r--r--flang/test/Semantics/OpenMP/clause-validity01.f903
-rw-r--r--flang/test/Semantics/OpenMP/if-clause-45.f90675
-rw-r--r--flang/test/Semantics/OpenMP/if-clause-50.f90641
-rw-r--r--flang/test/Semantics/OpenMP/symbol08.f903
-rw-r--r--flang/test/Semantics/assign02.f902
-rw-r--r--flang/test/Semantics/bug1214.cuf49
-rw-r--r--flang/test/Semantics/c_f_pointer.f908
-rw-r--r--flang/test/Semantics/cuf11.cuf2
-rw-r--r--flang/test/Semantics/resolve126.f907
54 files changed, 2555 insertions, 334 deletions
diff --git a/flang/test/CMakeLists.txt b/flang/test/CMakeLists.txt
index 8520bec..40f4a2e 100644
--- a/flang/test/CMakeLists.txt
+++ b/flang/test/CMakeLists.txt
@@ -65,6 +65,7 @@ set(FLANG_TEST_DEPENDS
bbc
FortranDecimal
)
+
if (NOT FLANG_STANDALONE_BUILD)
list(APPEND FLANG_TEST_DEPENDS
llvm-config
@@ -79,7 +80,7 @@ if (NOT FLANG_STANDALONE_BUILD)
)
endif ()
-if (LLVM_BUILD_EXAMPLES AND LLVM_ENABLE_PLUGINS AND NOT WIN32 AND NOT FLANG_STANDALONE_BUILD)
+if (LLVM_BUILD_EXAMPLES AND LLVM_ENABLE_PLUGINS AND NOT (WIN32 OR CYGWIN) AND NOT FLANG_STANDALONE_BUILD)
list(APPEND FLANG_TEST_DEPENDS Bye)
endif()
diff --git a/flang/test/Examples/omp-atomic.f90 b/flang/test/Examples/omp-atomic.f90
index 934f84f..5695b62 100644
--- a/flang/test/Examples/omp-atomic.f90
+++ b/flang/test/Examples/omp-atomic.f90
@@ -31,13 +31,13 @@ end
! CHECK-NEXT: - clause: read
! CHECK-NEXT: details: ''
! CHECK-NEXT: - clause: seq_cst
-! CHECK-NEXT: details: 'name_modifier=atomic;'
+! CHECK-NEXT: details: ''
! CHECK-NEXT:- file: '{{[^"]*}}omp-atomic.f90'
! CHECK-NEXT: line: 12
! CHECK-NEXT: construct: atomic
! CHECK-NEXT: clauses:
! CHECK-NEXT: - clause: seq_cst
-! CHECK-NEXT: details: 'name_modifier=atomic;'
+! CHECK-NEXT: details: ''
! CHECK-NEXT: - clause: write
! CHECK-NEXT: details: ''
! CHECK-NEXT:- file: '{{[^"]*}}omp-atomic.f90'
@@ -45,7 +45,7 @@ end
! CHECK-NEXT: construct: atomic
! CHECK-NEXT: clauses:
! CHECK-NEXT: - clause: capture
-! CHECK-NEXT: details: 'name_modifier=atomic;name_modifier=atomic;'
+! CHECK-NEXT: details: ''
! CHECK-NEXT: - clause: seq_cst
! CHECK-NEXT: details: ''
! CHECK-NEXT:- file: '{{[^"]*}}omp-atomic.f90'
diff --git a/flang/test/Examples/omp-sections.f90 b/flang/test/Examples/omp-sections.f90
index 41e6e8f..a6d2806 100644
--- a/flang/test/Examples/omp-sections.f90
+++ b/flang/test/Examples/omp-sections.f90
@@ -13,11 +13,11 @@ subroutine omp_sections()
end subroutine omp_sections
!CHECK: - file: {{.*}}
-!CHECK: line: 9
+!CHECK: line: 8
!CHECK: construct: section
!CHECK: clauses: []
!CHECK: - file: {{.*}}
-!CHECK: line: 11
+!CHECK: line: 10
!CHECK: construct: section
!CHECK: clauses: []
!CHECK: - file: {{.*}}
diff --git a/flang/test/Fir/FirToSCF/if.fir b/flang/test/Fir/FirToSCF/if.fir
new file mode 100644
index 0000000..03be264
--- /dev/null
+++ b/flang/test/Fir/FirToSCF/if.fir
@@ -0,0 +1,57 @@
+// RUN: fir-opt %s --fir-to-scf | FileCheck %s
+
+// CHECK-LABEL: func.func @test_only(
+// CHECK-SAME: %[[ARG0:.*]]: i1, %[[ARG1:.*]]: i32) {
+// CHECK: scf.if %[[ARG0]] {
+// CHECK: %[[VAL_1:.*]] = arith.addi %[[ARG1]], %[[ARG1]] : i32
+// CHECK: }
+// CHECK: return
+// CHECK: }
+func.func @test_only(%arg0 : i1, %arg1 : i32) {
+ fir.if %arg0 {
+ %0 = arith.addi %arg1, %arg1 : i32
+ }
+ return
+}
+
+// CHECK-LABEL: func.func @test_else() {
+// CHECK: %[[VAL_1:.*]] = arith.constant false
+// CHECK: %[[VAL_2:.*]] = arith.constant 2 : i32
+// CHECK: scf.if %[[VAL_1]] {
+// CHECK: %[[VAL_3:.*]] = arith.constant 3 : i32
+// CHECK: } else {
+// CHECK: %[[VAL_3:.*]] = arith.constant 3 : i32
+// CHECK: }
+// CHECK: return
+// CHECK: }
+func.func @test_else() {
+ %false = arith.constant false
+ %1 = arith.constant 2 : i32
+ fir.if %false {
+ %2 = arith.constant 3 : i32
+ } else {
+ %3 = arith.constant 3 : i32
+ }
+ return
+}
+
+// CHECK-LABEL: func.func @test_two_result() {
+// CHECK: %[[VAL_1:.*]] = arith.constant 2.000000e+00 : f32
+// CHECK: %[[VAL_2:.*]] = arith.constant false
+// CHECK: %[[RES:[0-9]+]]:2 = scf.if %[[VAL_2]] -> (f32, f32) {
+// CHECK: scf.yield %[[VAL_1]], %[[VAL_1]] : f32, f32
+// CHECK: } else {
+// CHECK: scf.yield %[[VAL_1]], %[[VAL_1]] : f32, f32
+// CHECK: }
+// CHECK: return
+// CHECK: }
+func.func @test_two_result() {
+ %1 = arith.constant 2.0 : f32
+ %cmp = arith.constant false
+ %x, %y = fir.if %cmp -> (f32, f32) {
+ fir.result %1, %1 : f32, f32
+ } else {
+ fir.result %1, %1 : f32, f32
+ }
+ return
+}
diff --git a/flang/test/Lower/Intrinsics/c_f_pointer.f90 b/flang/test/Lower/Intrinsics/c_f_pointer.f90
index 67817e3..c1f1d79 100644
--- a/flang/test/Lower/Intrinsics/c_f_pointer.f90
+++ b/flang/test/Lower/Intrinsics/c_f_pointer.f90
@@ -140,3 +140,78 @@ subroutine dynamic_shape_size_2(cptr, fptr, shape, n)
! CHECK: %[[VAL_16:.*]] = fir.shape %[[VAL_11]], %[[VAL_15]] : (index, index) -> !fir.shape<2>
call c_f_pointer(cptr, fptr, shape)
end subroutine
+
+! CHECK-LABEL: func.func @_QPdynamic_shape_lower(
+subroutine dynamic_shape_lower(cptr, fpr, shape, lower)
+ use iso_c_binding
+ type(c_ptr) :: cptr
+ real, pointer :: fptr(:, :)
+ integer :: n
+ integer :: shape(:)
+ integer :: lower(:)
+! CHECK: %[[C_0:.*]] = arith.constant 0 : index
+! CHECK: %[[VAL_2:.*]] = fir.shape %[[C_0]], %[[C_0]] : (index, index) -> !fir.shape<2>
+! CHECK: %[[VAL_3:.*]] = fir.embox %[[VAL_1:.*]](%[[VAL_2]]) : (!fir.ptr<!fir.array<?x?xf32>>, !fir.shape<2>) -> !fir.box<!fir.ptr<!fir.array<?x?xf32>>>
+! CHECK: fir.store %[[VAL_3]] to %[[VAL_0:.*]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x?xf32>>>>
+! CHECK: %[[VAL_4:.*]] = fir.alloca i32 {bindc_name = "n", uniq_name = "_QFdynamic_shape_lowerEn"}
+! CHECK: %[[VAL_5:.*]] = fir.coordinate_of %[[ARG_0:.*]], __address : (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) -> !fir.ref<i64>
+! CHECK: %[[VAL_6:.*]] = fir.load %[[VAL_5]] : !fir.ref<i64>
+! CHECK: %[[VAL_7:.*]] = fir.convert %[[VAL_6]] : (i64) -> !fir.ptr<!fir.array<?x?xf32>>
+! CHECK: %[[C_0:.*]]_0 = arith.constant 0 : index
+! CHECK: %[[VAL_8:.*]] = fir.coordinate_of %[[ARG_2:.*]], %[[C_0]]_0 : (!fir.box<!fir.array<?xi32>>, index) -> !fir.ref<i32>
+! CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_8]] : !fir.ref<i32>
+! CHECK: %[[VAL_10:.*]] = fir.convert %[[VAL_9]] : (i32) -> index
+! CHECK: %[[C_1:.*]] = arith.constant 1 : index
+! CHECK: %[[VAL_11:.*]] = fir.coordinate_of %[[ARG_2:.*]], %[[C_1]] : (!fir.box<!fir.array<?xi32>>, index) -> !fir.ref<i32>
+! CHECK: %[[VAL_12:.*]] = fir.load %[[VAL_11]] : !fir.ref<i32>
+! CHECK: %[[VAL_13:.*]] = fir.convert %[[VAL_12]] : (i32) -> index
+! CHECK: %[[C_0:.*]]_1 = arith.constant 0 : index
+! CHECK: %[[VAL_14:.*]] = fir.coordinate_of %[[ARG_3:.*]], %[[C_0]]_1 : (!fir.box<!fir.array<?xi32>>, index) -> !fir.ref<i32>
+! CHECK: %[[VAL_15:.*]] = fir.load %[[VAL_14]] : !fir.ref<i32>
+! CHECK: %[[VAL_16:.*]] = fir.convert %[[VAL_15]] : (i32) -> index
+! CHECK: %[[C_1:.*]]_2 = arith.constant 1 : index
+! CHECK: %[[VAL_17:.*]] = fir.coordinate_of %[[ARG_3:.*]], %[[C_1]]_2 : (!fir.box<!fir.array<?xi32>>, index) -> !fir.ref<i32>
+! CHECK: %[[VAL_18:.*]] = fir.load %[[VAL_17]] : !fir.ref<i32>
+! CHECK: %[[VAL_19:.*]] = fir.convert %[[VAL_18]] : (i32) -> index
+! CHECK: %[[VAL_20:.*]] = fir.shape_shift %[[VAL_16]], %[[VAL_10]], %[[VAL_19]], %[[VAL_13]] : (index, index, index, index) -> !fir.shapeshift<2>
+! CHECK: %[[VAL_21:.*]] = fir.embox %[[VAL_7]](%[[VAL_20]]) : (!fir.ptr<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.box<!fir.ptr<!fir.array<?x?xf32>>>
+! CHECK: fir.store %[[VAL_21:.*]] to %[[VAL_0]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x?xf32>>>>
+ call c_f_pointer(cptr, fptr, shape, lower)
+end subroutine dynamic_shape_lower
+
+! CHECK-LABEL: func.func @_QPdynamic_shape_lower_2(
+subroutine dynamic_shape_lower_2(cptr, fpr, shape, lower, n)
+ use iso_c_binding
+ type(c_ptr) :: cptr
+ real, pointer :: fptr(:, :)
+ integer :: n
+ integer :: shape(n)
+ integer :: lower(n)
+!CHECK: %[[C_0:.*]] = arith.constant 0 : index
+!CHECK: %[[VAL_2:.*]] = fir.shape %[[C_0]], %[[C_0]] : (index, index) -> !fir.shape<2>
+!CHECK: %[[VAL_3:.*]] = fir.embox %[[ARG1:.*]](%[[VAL_2]]) : (!fir.ptr<!fir.array<?x?xf32>>, !fir.shape<2>) -> !fir.box<!fir.ptr<!fir.array<?x?xf32>>>
+!CHECK: fir.store %[[VAL_3]] to %[[VAL_0:.*]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x?xf32>>>>
+!CHECK: %[[VAL_4:.*]] = fir.coordinate_of %[[ARG_0:.*]], __address : (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) -> !fir.ref<i64>
+!CHECK: %[[VAL_5:.*]] = fir.load %[[VAL_4]] : !fir.ref<i64>
+!CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_5]] : (i64) -> !fir.ptr<!fir.array<?x?xf32>>
+!CHECK: %[[C_0:.*]]_0 = arith.constant 0 : index
+!CHECK: %[[VAL_7:.*]] = fir.coordinate_of %[[ARG_2:.*]], %[[C_0]]_0 : (!fir.ref<!fir.array<?xi32>>, index) -> !fir.ref<i32>
+!CHECK: %[[VAL_8:.*]] = fir.load %[[VAL_7]] : !fir.ref<i32>
+!CHECK: %[[VAL_9:.*]] = fir.convert %[[VAL_8]] : (i32) -> index
+!CHECK: %[[C_1:.*]] = arith.constant 1 : index
+!CHECK: %[[VAL_10:.*]] = fir.coordinate_of %[[ARG_2]], %[[C_1]] : (!fir.ref<!fir.array<?xi32>>, index) -> !fir.ref<i32>
+!CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_10]] : !fir.ref<i32>
+!CHECK: %[[VAL_12:.*]] = fir.convert %[[VAL_11]] : (i32) -> index
+!CHECK: %[[C_0:.*]]_1 = arith.constant 0 : index
+!CHECK: %[[VAL_13:.*]] = fir.coordinate_of %[[ARG_3:.*]], %[[C_0]]_1 : (!fir.ref<!fir.array<?xi32>>, index) -> !fir.ref<i32>
+!CHECK: %[[VAL_14:.*]] = fir.load %[[VAL_13]] : !fir.ref<i32>
+!CHECK: %[[VAL_15:.*]] = fir.convert %[[VAL_14]] : (i32) -> index
+!CHECK: %[[C_1:.*]]_2 = arith.constant 1 : index
+!CHECK: %[[VAL_16:.*]] = fir.coordinate_of %[[ARG_3]], %[[C_1]]_2 : (!fir.ref<!fir.array<?xi32>>, index) -> !fir.ref<i32>
+!CHECK: %[[VAL_17:.*]] = fir.load %[[VAL_16]] : !fir.ref<i32>
+!CHECK: %[[VAL_18:.*]] = fir.convert %[[VAL_17]] : (i32) -> index
+!CHECK: %[[VAL_19:.*]] = fir.shape_shift %[[VAL_15]], %[[VAL_9]], %[[VAL_18]], %[[VAL_12]] : (index, index, index, index) -> !fir.shapeshift<2>
+!CHECK: %[[VAL_20:.*]] = fir.embox %[[VAL_6]](%[[VAL_19]]) : (!fir.ptr<!fir.array<?x?xf32>>, !fir.shapeshift<2>)
+!CHECK: fir.store %[[VAL_20]] to %[[VAL_0]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x?xf32>>>>
+ call c_f_pointer(cptr, fptr, shape, lower)
+end subroutine dynamic_shape_lower_2
diff --git a/flang/test/Lower/OpenACC/Todo/do-loops-to-acc-loops-todo.f90 b/flang/test/Lower/OpenACC/Todo/do-loops-to-acc-loops-todo.f90
new file mode 100644
index 0000000..aa1d443
--- /dev/null
+++ b/flang/test/Lower/OpenACC/Todo/do-loops-to-acc-loops-todo.f90
@@ -0,0 +1,91 @@
+! RUN: split-file %s %t
+! RUN: %not_todo_cmd bbc -fopenacc -emit-hlfir %t/do_loop_with_stop.f90 -o - 2>&1 | FileCheck %s --check-prefix=CHECK1
+! RUN: %not_todo_cmd bbc -fopenacc -emit-hlfir %t/do_loop_with_cycle_goto.f90 -o - 2>&1 | FileCheck %s --check-prefix=CHECK2
+! RUN: %not_todo_cmd bbc -fopenacc -emit-hlfir %t/nested_goto_loop.f90 -o - 2>&1 | FileCheck %s --check-prefix=CHECK3
+! RUN: %not_todo_cmd bbc -fopenacc -emit-hlfir %t/nested_loop_with_inner_goto.f90 -o - 2>&1 | FileCheck %s --check-prefix=CHECK4
+
+//--- do_loop_with_stop.f90
+
+subroutine do_loop_with_stop()
+ integer :: i
+ integer, parameter :: n = 10
+ real, dimension(n) :: a, b
+
+ !$acc kernels
+ do i = 1, n
+ a(i) = b(i) + 1.0
+ if (i == 5) stop
+ end do
+ !$acc end kernels
+
+! CHECK1: not yet implemented: unstructured do loop in acc kernels
+
+end subroutine
+
+//--- do_loop_with_cycle_goto.f90
+
+subroutine do_loop_with_cycle_goto()
+ integer :: i
+ integer, parameter :: n = 10
+ real, dimension(n) :: a, b
+
+ ! Do loop with cycle and goto - unstructured control flow is not converted.
+ !$acc kernels
+ do i = 1, n
+ if (i == 3) cycle
+ a(i) = b(i) + 1.0
+ if (i == 7) goto 200
+ a(i) = a(i) * 2.0
+ end do
+200 continue
+ !$acc end kernels
+
+! CHECK2: not yet implemented: unstructured do loop in acc kernels
+
+end subroutine
+
+//--- nested_goto_loop.f90
+
+subroutine nested_goto_loop()
+ integer :: i, j
+ integer, parameter :: n = 10, m = 5
+ real, dimension(n,m) :: a, b
+
+ ! Nested loop with goto from inner to outer - should NOT convert to acc.loop
+ !$acc kernels
+ do i = 1, n
+ do j = 1, m
+ a(i,j) = b(i,j) + 1.0
+ if (i * j > 20) goto 300 ! Exit both loops
+ end do
+ end do
+300 continue
+ !$acc end kernels
+
+! CHECK3: not yet implemented: unstructured do loop in acc kernels
+
+end subroutine
+
+//--- nested_loop_with_inner_goto.f90
+
+subroutine nested_loop_with_inner_goto()
+ integer :: ii = 0, jj = 0
+ integer, parameter :: nn = 3
+ real, dimension(nn, nn) :: aa
+
+ aa = -1
+
+ ! Nested loop with goto from inner loop - unstructured control flow is not converted.
+ !$acc kernels
+ do ii = 1, nn
+ do jj = 1, nn
+ if (jj > 1) goto 300
+ aa(jj, ii) = 1337
+ end do
+ 300 continue
+ end do
+ !$acc end kernels
+
+! CHECK4: not yet implemented: unstructured do loop in acc kernels
+
+end subroutine \ No newline at end of file
diff --git a/flang/test/Lower/OpenACC/acc-atomic-capture.f90 b/flang/test/Lower/OpenACC/acc-atomic-capture.f90
index ee38ab6..30e60e3 100644
--- a/flang/test/Lower/OpenACC/acc-atomic-capture.f90
+++ b/flang/test/Lower/OpenACC/acc-atomic-capture.f90
@@ -123,17 +123,20 @@ end subroutine
! CHECK: }
subroutine capture_with_convert_i32_to_f64()
- real(8) :: x
- integer :: v
+ real(8) :: x
+ integer :: v, u
x = 1.0
v = 0
+ u = 1
!$acc atomic capture
v = x
- x = v
+ x = u
!$acc end atomic
end subroutine capture_with_convert_i32_to_f64
! CHECK-LABEL: func.func @_QPcapture_with_convert_i32_to_f64()
+! CHECK: %[[U:.*]] = fir.alloca i32 {bindc_name = "u", uniq_name = "_QFcapture_with_convert_i32_to_f64Eu"}
+! CHECK: %[[U_DECL:.*]]:2 = hlfir.declare %[[U]] {uniq_name = "_QFcapture_with_convert_i32_to_f64Eu"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
! CHECK: %[[V:.*]] = fir.alloca i32 {bindc_name = "v", uniq_name = "_QFcapture_with_convert_i32_to_f64Ev"}
! CHECK: %[[V_DECL:.*]]:2 = hlfir.declare %[[V]] {uniq_name = "_QFcapture_with_convert_i32_to_f64Ev"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
! CHECK: %[[X:.*]] = fir.alloca f64 {bindc_name = "x", uniq_name = "_QFcapture_with_convert_i32_to_f64Ex"}
@@ -142,7 +145,9 @@ end subroutine capture_with_convert_i32_to_f64
! CHECK: hlfir.assign %[[CST]] to %[[X_DECL]]#0 : f64, !fir.ref<f64>
! CHECK: %c0_i32 = arith.constant 0 : i32
! CHECK: hlfir.assign %c0_i32 to %[[V_DECL]]#0 : i32, !fir.ref<i32>
-! CHECK: %[[LOAD:.*]] = fir.load %[[V_DECL]]#0 : !fir.ref<i32>
+! CHECK: %c1_i32 = arith.constant 1 : i32
+! CHECK: hlfir.assign %c1_i32 to %[[U_DECL]]#0 : i32, !fir.ref<i32>
+! CHECK: %[[LOAD:.*]] = fir.load %[[U_DECL]]#0 : !fir.ref<i32>
! CHECK: %[[CONV:.*]] = fir.convert %[[LOAD]] : (i32) -> f64
! CHECK: acc.atomic.capture {
! CHECK: acc.atomic.read %[[V_DECL]]#0 = %[[X_DECL]]#0 : !fir.ref<i32>, !fir.ref<f64>, f64
@@ -155,7 +160,7 @@ subroutine capture_with_convert_f64_to_i32()
x = 1
v = 0
!$acc atomic capture
- x = v * v
+ x = x * 2.0_8
v = x
!$acc end atomic
end subroutine capture_with_convert_f64_to_i32
@@ -167,15 +172,14 @@ end subroutine capture_with_convert_f64_to_i32
! CHECK: %[[X_DECL:.*]]:2 = hlfir.declare %[[X]] {uniq_name = "_QFcapture_with_convert_f64_to_i32Ex"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
! CHECK: %c1_i32 = arith.constant 1 : i32
! CHECK: hlfir.assign %c1_i32 to %[[X_DECL]]#0 : i32, !fir.ref<i32>
-! CHECK: %[[CST:.*]] = arith.constant 0.000000e+00 : f64
-! CHECK: hlfir.assign %[[CST]] to %[[V_DECL]]#0 : f64, !fir.ref<f64>
-! CHECK: %[[LOAD:.*]] = fir.load %[[V_DECL]]#0 : !fir.ref<f64>
+! CHECK: %[[CST:.*]] = arith.constant 2.000000e+00 : f64
! CHECK: acc.atomic.capture {
! CHECK: acc.atomic.update %[[X_DECL]]#0 : !fir.ref<i32> {
-! CHECK: ^bb0(%arg0: i32):
-! CHECK: %[[MUL:.*]] = arith.mulf %[[LOAD]], %[[LOAD]] fastmath<contract> : f64
-! CHECK: %[[CONV:.*]] = fir.convert %[[MUL]] : (f64) -> i32
-! CHECK: acc.yield %[[CONV]] : i32
+! CHECK: ^bb0(%[[ARG:.*]]: i32):
+! CHECK: %[[CONV_ARG:.*]] = fir.convert %[[ARG]] : (i32) -> f64
+! CHECK: %[[MUL:.*]] = arith.mulf %[[CONV_ARG]], %[[CST]] fastmath<contract> : f64
+! CHECK: %[[CONV_MUL:.*]] = fir.convert %[[MUL]] : (f64) -> i32
+! CHECK: acc.yield %[[CONV_MUL]] : i32
! CHECK: }
! CHECK: acc.atomic.read %[[V_DECL]]#0 = %[[X_DECL]]#0 : !fir.ref<f64>, !fir.ref<i32>, i32
! CHECK: }
diff --git a/flang/test/Lower/OpenACC/do-loops-to-acc-loops.f90 b/flang/test/Lower/OpenACC/do-loops-to-acc-loops.f90
new file mode 100644
index 0000000..5f8ea03
--- /dev/null
+++ b/flang/test/Lower/OpenACC/do-loops-to-acc-loops.f90
@@ -0,0 +1,267 @@
+! This test checks lowering of Fortran do loops and do concurrent loops to OpenACC loop constructs.
+! Tests the new functionality that converts Fortran iteration constructs to acc.loop with proper IV handling.
+
+! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s
+
+! CHECK-LABEL: func.func @_QPbasic_do_loop
+subroutine basic_do_loop()
+ integer :: i
+ integer, parameter :: n = 10
+ real, dimension(n) :: a, b
+
+ ! Basic do loop that should be converted to acc.loop
+ !$acc kernels
+ do i = 1, n
+ a(i) = b(i) + 1.0
+ end do
+ !$acc end kernels
+
+! CHECK: acc.kernels {
+! CHECK: acc.loop {{.*}} control(%{{.*}} : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32)
+! CHECK: acc.yield
+! CHECK: attributes {auto_ = [#acc.device_type<none>], inclusiveUpperbound = array<i1: true>}
+
+end subroutine
+
+! CHECK-LABEL: func.func @_QPbasic_do_concurrent
+subroutine basic_do_concurrent()
+ integer :: i
+ integer, parameter :: n = 10
+ real, dimension(n) :: a, b
+
+ ! Basic do concurrent loop
+ !$acc kernels
+ do concurrent (i = 1:n)
+ a(i) = b(i) + 1.0
+ end do
+ !$acc end kernels
+
+! CHECK: acc.kernels {
+! CHECK: acc.loop {{.*}} control(%{{.*}} : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32)
+! CHECK: acc.yield
+! CHECK: attributes {auto_ = [#acc.device_type<none>], inclusiveUpperbound = array<i1: true>}
+
+end subroutine
+
+! CHECK-LABEL: func.func @_QPbasic_do_loop_parallel
+subroutine basic_do_loop_parallel()
+ integer :: i
+ integer, parameter :: n = 10
+ real, dimension(n) :: a, b
+
+ ! Basic do loop with acc parallel that should be converted to acc.loop
+ !$acc parallel
+ do i = 1, n
+ a(i) = b(i) + 1.0
+ end do
+ !$acc end parallel
+
+! CHECK: acc.parallel {
+! CHECK: acc.loop {{.*}} control(%{{.*}} : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32)
+! CHECK: acc.yield
+! CHECK: attributes {auto_ = [#acc.device_type<none>], inclusiveUpperbound = array<i1: true>}
+
+end subroutine
+
+! CHECK-LABEL: func.func @_QPbasic_do_loop_serial
+subroutine basic_do_loop_serial()
+ integer :: i
+ integer, parameter :: n = 10
+ real, dimension(n) :: a, b
+
+ ! Basic do loop with acc serial that should be converted to acc.loop
+ !$acc serial
+ do i = 1, n
+ a(i) = b(i) + 1.0
+ end do
+ !$acc end serial
+
+! CHECK: acc.serial {
+! CHECK: acc.loop {{.*}} control(%{{.*}} : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32)
+! CHECK: acc.yield
+! CHECK: attributes {inclusiveUpperbound = array<i1: true>, seq = [#acc.device_type<none>]}
+
+end subroutine
+
+! CHECK-LABEL: func.func @_QPbasic_do_concurrent_parallel
+subroutine basic_do_concurrent_parallel()
+ integer :: i
+ integer, parameter :: n = 10
+ real, dimension(n) :: a, b
+
+ ! Basic do concurrent loop with acc parallel
+ !$acc parallel
+ do concurrent (i = 1:n)
+ a(i) = b(i) + 1.0
+ end do
+ !$acc end parallel
+
+! CHECK: acc.parallel {
+! CHECK: acc.loop {{.*}} control(%{{.*}} : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32)
+! CHECK: acc.yield
+! CHECK: attributes {inclusiveUpperbound = array<i1: true>, independent = [#acc.device_type<none>]}
+
+end subroutine
+
+! CHECK-LABEL: func.func @_QPbasic_do_concurrent_serial
+subroutine basic_do_concurrent_serial()
+ integer :: i
+ integer, parameter :: n = 10
+ real, dimension(n) :: a, b
+
+ ! Basic do concurrent loop with acc serial
+ !$acc serial
+ do concurrent (i = 1:n)
+ a(i) = b(i) + 1.0
+ end do
+ !$acc end serial
+
+! CHECK: acc.serial {
+! CHECK: acc.loop {{.*}} control(%{{.*}} : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32)
+! CHECK: acc.yield
+! CHECK: attributes {inclusiveUpperbound = array<i1: true>, seq = [#acc.device_type<none>]}
+
+end subroutine
+
+! CHECK-LABEL: func.func @_QPmulti_dimension_do_concurrent
+subroutine multi_dimension_do_concurrent()
+ integer :: i, j, k
+ integer, parameter :: n = 10, m = 20, l = 5
+ real, dimension(n,m,l) :: a, b
+
+ ! Multi-dimensional do concurrent with multiple iteration variables
+ !$acc kernels
+ do concurrent (i = 1:n, j = 1:m, k = 1:l)
+ a(i,j,k) = b(i,j,k) * 2.0
+ end do
+ !$acc end kernels
+
+! CHECK: acc.kernels {
+! CHECK: acc.loop {{.*}} control(%{{.*}} : i32, %{{.*}} : i32, %{{.*}} : i32) = (%c1{{.*}}, %c1{{.*}}, %c1{{.*}} : i32, i32, i32) to (%{{.*}}, %{{.*}}, %{{.*}} : i32, i32, i32) step (%c1{{.*}}, %c1{{.*}}, %c1{{.*}} : i32, i32, i32)
+! CHECK: acc.yield
+! CHECK: attributes {auto_ = [#acc.device_type<none>], inclusiveUpperbound = array<i1: true, true, true>}
+end subroutine
+
+
+! CHECK-LABEL: func.func @_QPnested_do_loops
+subroutine nested_do_loops()
+ integer :: i, j
+ integer, parameter :: n = 10, m = 20
+ real, dimension(n,m) :: a, b
+
+ ! Nested do loops
+ !$acc kernels
+ do i = 1, n
+ do j = 1, m
+ a(i,j) = b(i,j) + i + j
+ end do
+ end do
+ !$acc end kernels
+
+! CHECK: acc.kernels {
+! CHECK: acc.loop {{.*}} control(%{{.*}} : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32)
+! CHECK: acc.loop {{.*}} control(%{{.*}} : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32)
+! CHECK: acc.yield
+! CHECK: attributes {auto_ = [#acc.device_type<none>], inclusiveUpperbound = array<i1: true>}
+! CHECK: acc.yield
+! CHECK: attributes {auto_ = [#acc.device_type<none>], inclusiveUpperbound = array<i1: true>}
+
+end subroutine
+
+! CHECK-LABEL: func.func @_QPvariable_bounds_and_step
+subroutine variable_bounds_and_step(n, start_val, step_val)
+ integer, intent(in) :: n, start_val, step_val
+ integer :: i
+ real, dimension(n) :: a, b
+
+ ! Do loop with variable bounds and step
+ !$acc kernels
+ do i = start_val, n, step_val
+ a(i) = b(i) * 2.0
+ end do
+ !$acc end kernels
+
+! CHECK: acc.kernels {
+! CHECK: acc.loop {{.*}} control(%{{.*}} : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32)
+! CHECK: acc.yield
+! CHECK: attributes {auto_ = [#acc.device_type<none>], inclusiveUpperbound = array<i1: true>}
+
+end subroutine
+
+! CHECK-LABEL: func.func @_QPdifferent_iv_types
+subroutine different_iv_types()
+ integer(kind=8) :: i8
+ integer(kind=4) :: i4
+ integer(kind=2) :: i2
+ integer, parameter :: n = 10
+ real, dimension(n) :: a, b, c, d
+
+ ! Test different iteration variable types
+ !$acc kernels
+ do i8 = 1_8, int(n,8)
+ a(i8) = b(i8) + 1.0
+ end do
+ !$acc end kernels
+
+ !$acc kernels
+ do i4 = 1, n
+ b(i4) = c(i4) + 1.0
+ end do
+ !$acc end kernels
+
+ !$acc kernels
+ do i2 = 1_2, int(n,2)
+ c(i2) = d(i2) + 1.0
+ end do
+ !$acc end kernels
+
+! CHECK: acc.kernels {
+! CHECK: acc.loop {{.*}} control(%{{.*}} : i64) = (%{{.*}} : i64) to (%{{.*}} : i64) step (%{{.*}} : i64)
+! CHECK: acc.kernels {
+! CHECK: acc.loop {{.*}} control(%{{.*}} : i32) = (%{{.*}} : i32) to (%{{.*}} : i32) step (%{{.*}} : i32)
+! CHECK: acc.kernels {
+! CHECK: acc.loop {{.*}} control(%{{.*}} : i16) = (%{{.*}} : i16) to (%{{.*}} : i16) step (%{{.*}} : i16)
+
+end subroutine
+
+! -----------------------------------------------------------------------------------------
+! Tests for loops that should NOT be converted to acc.loop due to unstructured control flow
+
+! CHECK-LABEL: func.func @_QPinfinite_loop_no_iv
+subroutine infinite_loop_no_iv()
+ integer :: i
+ logical :: condition
+
+ ! Infinite loop with no induction variable - should NOT convert to acc.loop
+ !$acc kernels
+ do
+ i = i + 1
+ if (i > 100) exit
+ end do
+ !$acc end kernels
+
+! CHECK: acc.kernels {
+! CHECK-NOT: acc.loop
+
+end subroutine
+
+! CHECK-LABEL: func.func @_QPwhile_like_loop
+subroutine while_like_loop()
+ integer :: i
+ logical :: condition
+
+ i = 1
+ condition = .true.
+
+ ! While-like infinite loop - should NOT convert to acc.loop
+ !$acc kernels
+ do while (condition)
+ i = i + 1
+ if (i > 100) condition = .false.
+ end do
+ !$acc end kernels
+
+! CHECK: acc.kernels {
+! CHECK-NOT: acc.loop
+
+end subroutine
diff --git a/flang/test/Lower/OpenMP/atomic-control-options.f90 b/flang/test/Lower/OpenMP/atomic-control-options.f90
index 8f86a15..407f83b 100644
--- a/flang/test/Lower/OpenMP/atomic-control-options.f90
+++ b/flang/test/Lower/OpenMP/atomic-control-options.f90
@@ -1,7 +1,7 @@
-! RUN: %flang_fc1 -emit-hlfir -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-device -munsafe-fp-atomics %s -o - | FileCheck -check-prefix=UNSAFE-FP-ATOMICS %s
-! RUN: %flang_fc1 -emit-hlfir -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-device -fatomic-ignore-denormal-mode %s -o - | FileCheck -check-prefix=IGNORE-DENORMAL %s
-! RUN: %flang_fc1 -emit-hlfir -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-device -fatomic-fine-grained-memory %s -o - | FileCheck -check-prefix=FINE-GRAINED-MEMORY %s
-! RUN: %flang_fc1 -emit-hlfir -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-device -fatomic-remote-memory %s -o - | FileCheck -check-prefix=REMOTE-MEMORY %s
+! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-is-device -munsafe-fp-atomics %s -o - | FileCheck -check-prefix=UNSAFE-FP-ATOMICS %s
+! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-is-device -fatomic-ignore-denormal-mode %s -o - | FileCheck -check-prefix=IGNORE-DENORMAL %s
+! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-is-device -fatomic-fine-grained-memory %s -o - | FileCheck -check-prefix=FINE-GRAINED-MEMORY %s
+! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-is-device -fatomic-remote-memory %s -o - | FileCheck -check-prefix=REMOTE-MEMORY %s
program test
implicit none
integer :: A, B, threads
diff --git a/flang/test/Lower/OpenMP/distribute-simd.f90 b/flang/test/Lower/OpenMP/distribute-simd.f90
index a436001..d0316d1 100644
--- a/flang/test/Lower/OpenMP/distribute-simd.f90
+++ b/flang/test/Lower/OpenMP/distribute-simd.f90
@@ -7,7 +7,7 @@
subroutine distribute_simd_aligned(A)
use iso_c_binding
type(c_ptr) :: A
-
+
!$omp teams
! CHECK: omp.distribute
@@ -57,3 +57,22 @@ subroutine distribute_simd_simdlen()
!$omp end teams
end subroutine distribute_simd_simdlen
+
+! CHECK-LABEL: func.func @_QPdistribute_simd_private(
+subroutine distribute_simd_private()
+ integer, allocatable :: tmp
+ ! CHECK: omp.teams
+ !$omp teams
+ ! CHECK: omp.distribute
+ ! CHECK: omp.simd
+ ! CHECK-SAME: private(@[[PRIV_BOX_SYM:.*]] %{{.*}} -> %[[PRIV_BOX:.*]], @[[PRIV_IVAR_SYM:.*]] %{{.*}} -> %[[PRIV_IVAR:.*]] : !fir.ref<!fir.box<!fir.heap<i32>>>, !fir.ref<i32>)
+ ! CHECK-NEXT: omp.loop_nest (%[[IVAR:.*]]) : i32
+ !$omp distribute simd private(tmp)
+ do index_ = 1, 10
+ ! CHECK: %[[PRIV_BOX_DECL:.*]]:2 = hlfir.declare %[[PRIV_BOX]]
+ ! CHECK: %[[PRIV_IVAR_DECL:.*]]:2 = hlfir.declare %[[PRIV_IVAR]]
+ ! CHECK: hlfir.assign %[[IVAR]] to %[[PRIV_IVAR_DECL]]#0
+ end do
+ !$omp end distribute simd
+ !$omp end teams
+end subroutine distribute_simd_private
diff --git a/flang/test/Lower/OpenMP/optional-argument-map-3.f90 b/flang/test/Lower/OpenMP/optional-argument-map-3.f90
new file mode 100644
index 0000000..7e2a24e
--- /dev/null
+++ b/flang/test/Lower/OpenMP/optional-argument-map-3.f90
@@ -0,0 +1,46 @@
+!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
+
+module mod
+contains
+ subroutine foo(dt, switch)
+ implicit none
+ real(4), dimension(:), intent(inout) :: dt
+ logical, intent(in) :: switch
+ integer :: dim, idx
+
+ if (switch) then
+!$omp target teams distribute parallel do
+ do idx = 1, 100
+ dt(idx) = 20
+ end do
+ else
+!$omp target teams distribute parallel do
+ do idx = 1, 100
+ dt(idx) = 30
+ end do
+ end if
+ end subroutine foo
+end module
+
+! CHECK-LABEL: func.func @{{.*}}(
+! CHECK-SAME: %[[ARG0:.*]]: !fir.box<!fir.array<?xf32>> {fir.bindc_name = "dt"},
+! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.box<!fir.array<?xf32>>
+! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[ARG0]] dummy_scope {{.*}}
+! CHECK: fir.if %{{.*}} {
+! CHECK: %[[VAL_2:.*]] = fir.is_present %[[VAL_1]]#1 : (!fir.box<!fir.array<?xf32>>) -> i1
+! CHECK: fir.if %[[VAL_2]] {
+! CHECK: fir.store %[[VAL_1]]#1 to %[[VAL_0]] : !fir.ref<!fir.box<!fir.array<?xf32>>>
+! CHECK: }
+! CHECK: %[[VAL_3:.*]] = fir.box_offset %[[VAL_0]] base_addr : (!fir.ref<!fir.box<!fir.array<?xf32>>>) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>
+! CHECK: %[[VAL_4:.*]] = omp.map.info var_ptr(%[[VAL_0]] : !fir.ref<!fir.box<!fir.array<?xf32>>>, f32) map_clauses(implicit, tofrom) capture(ByRef) var_ptr_ptr(%[[VAL_3]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>) bounds(%{{.*}}) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>> {name = ""}
+! CHECK: %[[VAL_5:.*]] = omp.map.info var_ptr(%[[VAL_0]] : !fir.ref<!fir.box<!fir.array<?xf32>>>, !fir.box<!fir.array<?xf32>>) map_clauses(implicit, to) capture(ByRef) members(%[[VAL_4]] : [0] : !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>) -> !fir.ref<!fir.array<?xf32>> {name = "dt"}
+! CHECK: omp.target host_eval({{.*}}) map_entries({{.*}}%[[VAL_5]] -> {{.*}}, %[[VAL_4]] -> {{.*}} : {{.*}}) {
+! CHECK: } else {
+! CHECK: %[[VAL_6:.*]] = fir.is_present %[[VAL_1]]#1 : (!fir.box<!fir.array<?xf32>>) -> i1
+! CHECK: fir.if %[[VAL_6]] {
+! CHECK: fir.store %[[VAL_1]]#1 to %[[VAL_0]] : !fir.ref<!fir.box<!fir.array<?xf32>>>
+! CHECK: }
+! CHECK: %[[VAL_7:.*]] = fir.box_offset %[[VAL_0]] base_addr : (!fir.ref<!fir.box<!fir.array<?xf32>>>) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>
+! CHECK: %[[VAL_8:.*]] = omp.map.info var_ptr(%[[VAL_0]] : !fir.ref<!fir.box<!fir.array<?xf32>>>, f32) map_clauses(implicit, tofrom) capture(ByRef) var_ptr_ptr(%[[VAL_7]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>) bounds(%{{.*}}) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>> {name = ""}
+! CHECK: %[[VAL_9:.*]] = omp.map.info var_ptr(%[[VAL_0]] : !fir.ref<!fir.box<!fir.array<?xf32>>>, !fir.box<!fir.array<?xf32>>) map_clauses(implicit, to) capture(ByRef) members(%[[VAL_8]] : [0] : !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>) -> !fir.ref<!fir.array<?xf32>> {name = "dt"}
+! CHECK: omp.target host_eval({{.*}}) map_entries({{.*}}, %[[VAL_9]] ->{{.*}}, %[[VAL_8]] -> {{.*}} : {{.*}}) {
diff --git a/flang/test/Lower/OpenMP/unroll-heuristic01.f90 b/flang/test/Lower/OpenMP/unroll-heuristic01.f90
index a5f5c00..34020eb 100644
--- a/flang/test/Lower/OpenMP/unroll-heuristic01.f90
+++ b/flang/test/Lower/OpenMP/unroll-heuristic01.f90
@@ -13,27 +13,42 @@ subroutine omp_unroll_heuristic01(lb, ub, inc)
end subroutine omp_unroll_heuristic01
-!CHECK-LABEL: func.func @_QPomp_unroll_heuristic01(
-!CHECK: %c0_i32 = arith.constant 0 : i32
-!CHECK-NEXT: %c1_i32 = arith.constant 1 : i32
-!CHECK-NEXT: %13 = arith.cmpi slt, %12, %c0_i32 : i32
-!CHECK-NEXT: %14 = arith.subi %c0_i32, %12 : i32
-!CHECK-NEXT: %15 = arith.select %13, %14, %12 : i32
-!CHECK-NEXT: %16 = arith.select %13, %11, %10 : i32
-!CHECK-NEXT: %17 = arith.select %13, %10, %11 : i32
-!CHECK-NEXT: %18 = arith.subi %17, %16 overflow<nuw> : i32
-!CHECK-NEXT: %19 = arith.divui %18, %15 : i32
-!CHECK-NEXT: %20 = arith.addi %19, %c1_i32 overflow<nuw> : i32
-!CHECK-NEXT: %21 = arith.cmpi slt, %17, %16 : i32
-!CHECK-NEXT: %22 = arith.select %21, %c0_i32, %20 : i32
-!CHECK-NEXT: %canonloop_s0 = omp.new_cli
-!CHECK-NEXT: omp.canonical_loop(%canonloop_s0) %iv : i32 in range(%22) {
-!CHECK-NEXT: %23 = arith.muli %iv, %12 : i32
-!CHECK-NEXT: %24 = arith.addi %10, %23 : i32
-!CHECK-NEXT: hlfir.assign %24 to %9#0 : i32, !fir.ref<i32>
-!CHECK-NEXT: %25 = fir.load %9#0 : !fir.ref<i32>
-!CHECK-NEXT: hlfir.assign %25 to %6#0 : i32, !fir.ref<i32>
-!CHECK-NEXT: omp.terminator
-!CHECK-NEXT: }
-!CHECK-NEXT: omp.unroll_heuristic(%canonloop_s0)
-!CHECK-NEXT: return
+! CHECK-LABEL: func.func @_QPomp_unroll_heuristic01(
+! CHECK-SAME: %[[ARG0:.*]]: !fir.ref<i32> {fir.bindc_name = "lb"},
+! CHECK-SAME: %[[ARG1:.*]]: !fir.ref<i32> {fir.bindc_name = "ub"},
+! CHECK-SAME: %[[ARG2:.*]]: !fir.ref<i32> {fir.bindc_name = "inc"}) {
+! CHECK: %[[VAL_0:.*]] = fir.dummy_scope : !fir.dscope
+! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFomp_unroll_heuristic01Ei"}
+! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_1]] {uniq_name = "_QFomp_unroll_heuristic01Ei"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
+! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[ARG2]] dummy_scope %[[VAL_0]] {uniq_name = "_QFomp_unroll_heuristic01Einc"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %[[ARG0]] dummy_scope %[[VAL_0]] {uniq_name = "_QFomp_unroll_heuristic01Elb"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+! CHECK: %[[VAL_5:.*]] = fir.alloca i32 {bindc_name = "res", uniq_name = "_QFomp_unroll_heuristic01Eres"}
+! CHECK: %[[VAL_6:.*]]:2 = hlfir.declare %[[VAL_5]] {uniq_name = "_QFomp_unroll_heuristic01Eres"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
+! CHECK: %[[VAL_7:.*]]:2 = hlfir.declare %[[ARG1]] dummy_scope %[[VAL_0]] {uniq_name = "_QFomp_unroll_heuristic01Eub"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+! CHECK: %[[VAL_8:.*]] = fir.load %[[VAL_4]]#0 : !fir.ref<i32>
+! CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_7]]#0 : !fir.ref<i32>
+! CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_3]]#0 : !fir.ref<i32>
+! CHECK: %[[VAL_11:.*]] = arith.constant 0 : i32
+! CHECK: %[[VAL_12:.*]] = arith.constant 1 : i32
+! CHECK: %[[VAL_13:.*]] = arith.cmpi slt, %[[VAL_10]], %[[VAL_11]] : i32
+! CHECK: %[[VAL_14:.*]] = arith.subi %[[VAL_11]], %[[VAL_10]] : i32
+! CHECK: %[[VAL_15:.*]] = arith.select %[[VAL_13]], %[[VAL_14]], %[[VAL_10]] : i32
+! CHECK: %[[VAL_16:.*]] = arith.select %[[VAL_13]], %[[VAL_9]], %[[VAL_8]] : i32
+! CHECK: %[[VAL_17:.*]] = arith.select %[[VAL_13]], %[[VAL_8]], %[[VAL_9]] : i32
+! CHECK: %[[VAL_18:.*]] = arith.subi %[[VAL_17]], %[[VAL_16]] overflow<nuw> : i32
+! CHECK: %[[VAL_19:.*]] = arith.divui %[[VAL_18]], %[[VAL_15]] : i32
+! CHECK: %[[VAL_20:.*]] = arith.addi %[[VAL_19]], %[[VAL_12]] overflow<nuw> : i32
+! CHECK: %[[VAL_21:.*]] = arith.cmpi slt, %[[VAL_17]], %[[VAL_16]] : i32
+! CHECK: %[[VAL_22:.*]] = arith.select %[[VAL_21]], %[[VAL_11]], %[[VAL_20]] : i32
+! CHECK: %[[VAL_23:.*]] = omp.new_cli
+! CHECK: omp.canonical_loop(%[[VAL_23]]) %[[VAL_24:.*]] : i32 in range(%[[VAL_22]]) {
+! CHECK: %[[VAL_25:.*]] = arith.muli %[[VAL_24]], %[[VAL_10]] : i32
+! CHECK: %[[VAL_26:.*]] = arith.addi %[[VAL_8]], %[[VAL_25]] : i32
+! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_2]]#0 : i32, !fir.ref<i32>
+! CHECK: %[[VAL_27:.*]] = fir.load %[[VAL_2]]#0 : !fir.ref<i32>
+! CHECK: hlfir.assign %[[VAL_27]] to %[[VAL_6]]#0 : i32, !fir.ref<i32>
+! CHECK: omp.terminator
+! CHECK: }
+! CHECK: omp.unroll_heuristic(%[[VAL_23]])
+! CHECK: return
+! CHECK: } \ No newline at end of file
diff --git a/flang/test/Lower/OpenMP/unroll-heuristic02.f90 b/flang/test/Lower/OpenMP/unroll-heuristic02.f90
index 14f694d..fdb1366 100644
--- a/flang/test/Lower/OpenMP/unroll-heuristic02.f90
+++ b/flang/test/Lower/OpenMP/unroll-heuristic02.f90
@@ -37,61 +37,55 @@ end subroutine omp_unroll_heuristic_nested02
!CHECK: %[[VAL_10:.*]]:2 = hlfir.declare %[[ARG1]] dummy_scope %[[VAL_0]] {uniq_name = "_QFomp_unroll_heuristic_nested02Eouter_ub"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[VAL_11:.*]] = fir.alloca i32 {bindc_name = "res", uniq_name = "_QFomp_unroll_heuristic_nested02Eres"}
!CHECK: %[[VAL_12:.*]]:2 = hlfir.declare %[[VAL_11]] {uniq_name = "_QFomp_unroll_heuristic_nested02Eres"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
-!CHECK: %[[VAL_13:.*]] = fir.alloca i32 {bindc_name = "i", pinned, uniq_name = "_QFomp_unroll_heuristic_nested02Ei"}
-!CHECK: %[[VAL_14:.*]]:2 = hlfir.declare %[[VAL_13]] {uniq_name = "_QFomp_unroll_heuristic_nested02Ei"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
-!CHECK: %[[VAL_15:.*]] = fir.alloca i32 {bindc_name = "j", pinned, uniq_name = "_QFomp_unroll_heuristic_nested02Ej"}
-!CHECK: %[[VAL_16:.*]]:2 = hlfir.declare %[[VAL_15]] {uniq_name = "_QFomp_unroll_heuristic_nested02Ej"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
-!CHECK: %[[VAL_17:.*]] = fir.load %[[VAL_9]]#0 : !fir.ref<i32>
-!CHECK: %[[VAL_18:.*]] = fir.load %[[VAL_10]]#0 : !fir.ref<i32>
-!CHECK: %[[VAL_19:.*]] = fir.load %[[VAL_8]]#0 : !fir.ref<i32>
-!CHECK: %[[VAL_20:.*]] = arith.constant 0 : i32
-!CHECK: %[[VAL_21:.*]] = arith.constant 1 : i32
-!CHECK: %[[VAL_22:.*]] = arith.cmpi slt, %[[VAL_19]], %[[VAL_20]] : i32
-!CHECK: %[[VAL_23:.*]] = arith.subi %[[VAL_20]], %[[VAL_19]] : i32
-!CHECK: %[[VAL_24:.*]] = arith.select %[[VAL_22]], %[[VAL_23]], %[[VAL_19]] : i32
-!CHECK: %[[VAL_25:.*]] = arith.select %[[VAL_22]], %[[VAL_18]], %[[VAL_17]] : i32
-!CHECK: %[[VAL_26:.*]] = arith.select %[[VAL_22]], %[[VAL_17]], %[[VAL_18]] : i32
-!CHECK: %[[VAL_27:.*]] = arith.subi %[[VAL_26]], %[[VAL_25]] overflow<nuw> : i32
-!CHECK: %[[VAL_28:.*]] = arith.divui %[[VAL_27]], %[[VAL_24]] : i32
-!CHECK: %[[VAL_29:.*]] = arith.addi %[[VAL_28]], %[[VAL_21]] overflow<nuw> : i32
-!CHECK: %[[VAL_30:.*]] = arith.cmpi slt, %[[VAL_26]], %[[VAL_25]] : i32
-!CHECK: %[[VAL_31:.*]] = arith.select %[[VAL_30]], %[[VAL_20]], %[[VAL_29]] : i32
-!CHECK: %[[VAL_32:.*]] = omp.new_cli
-!CHECK: omp.canonical_loop(%[[VAL_32]]) %[[VAL_33:.*]] : i32 in range(%[[VAL_31]]) {
-!CHECK: %[[VAL_34:.*]] = arith.muli %[[VAL_33]], %[[VAL_19]] : i32
-!CHECK: %[[VAL_35:.*]] = arith.addi %[[VAL_17]], %[[VAL_34]] : i32
-!CHECK: hlfir.assign %[[VAL_35]] to %[[VAL_14]]#0 : i32, !fir.ref<i32>
-!CHECK: %[[VAL_36:.*]] = fir.alloca i32 {bindc_name = "j", pinned, uniq_name = "_QFomp_unroll_heuristic_nested02Ej"}
-!CHECK: %[[VAL_37:.*]]:2 = hlfir.declare %[[VAL_36]] {uniq_name = "_QFomp_unroll_heuristic_nested02Ej"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
-!CHECK: %[[VAL_38:.*]] = fir.load %[[VAL_4]]#0 : !fir.ref<i32>
-!CHECK: %[[VAL_39:.*]] = fir.load %[[VAL_5]]#0 : !fir.ref<i32>
-!CHECK: %[[VAL_40:.*]] = fir.load %[[VAL_3]]#0 : !fir.ref<i32>
-!CHECK: %[[VAL_41:.*]] = arith.constant 0 : i32
-!CHECK: %[[VAL_42:.*]] = arith.constant 1 : i32
-!CHECK: %[[VAL_43:.*]] = arith.cmpi slt, %[[VAL_40]], %[[VAL_41]] : i32
-!CHECK: %[[VAL_44:.*]] = arith.subi %[[VAL_41]], %[[VAL_40]] : i32
-!CHECK: %[[VAL_45:.*]] = arith.select %[[VAL_43]], %[[VAL_44]], %[[VAL_40]] : i32
-!CHECK: %[[VAL_46:.*]] = arith.select %[[VAL_43]], %[[VAL_39]], %[[VAL_38]] : i32
-!CHECK: %[[VAL_47:.*]] = arith.select %[[VAL_43]], %[[VAL_38]], %[[VAL_39]] : i32
-!CHECK: %[[VAL_48:.*]] = arith.subi %[[VAL_47]], %[[VAL_46]] overflow<nuw> : i32
-!CHECK: %[[VAL_49:.*]] = arith.divui %[[VAL_48]], %[[VAL_45]] : i32
-!CHECK: %[[VAL_50:.*]] = arith.addi %[[VAL_49]], %[[VAL_42]] overflow<nuw> : i32
-!CHECK: %[[VAL_51:.*]] = arith.cmpi slt, %[[VAL_47]], %[[VAL_46]] : i32
-!CHECK: %[[VAL_52:.*]] = arith.select %[[VAL_51]], %[[VAL_41]], %[[VAL_50]] : i32
-!CHECK: %[[VAL_53:.*]] = omp.new_cli
-!CHECK: omp.canonical_loop(%[[VAL_53]]) %[[VAL_54:.*]] : i32 in range(%[[VAL_52]]) {
-!CHECK: %[[VAL_55:.*]] = arith.muli %[[VAL_54]], %[[VAL_40]] : i32
-!CHECK: %[[VAL_56:.*]] = arith.addi %[[VAL_38]], %[[VAL_55]] : i32
-!CHECK: hlfir.assign %[[VAL_56]] to %[[VAL_37]]#0 : i32, !fir.ref<i32>
-!CHECK: %[[VAL_57:.*]] = fir.load %[[VAL_14]]#0 : !fir.ref<i32>
-!CHECK: %[[VAL_58:.*]] = fir.load %[[VAL_37]]#0 : !fir.ref<i32>
-!CHECK: %[[VAL_59:.*]] = arith.addi %[[VAL_57]], %[[VAL_58]] : i32
-!CHECK: hlfir.assign %[[VAL_59]] to %[[VAL_12]]#0 : i32, !fir.ref<i32>
+!CHECK: %[[VAL_13:.*]] = fir.load %[[VAL_9]]#0 : !fir.ref<i32>
+!CHECK: %[[VAL_14:.*]] = fir.load %[[VAL_10]]#0 : !fir.ref<i32>
+!CHECK: %[[VAL_15:.*]] = fir.load %[[VAL_8]]#0 : !fir.ref<i32>
+!CHECK: %[[VAL_16:.*]] = arith.constant 0 : i32
+!CHECK: %[[VAL_17:.*]] = arith.constant 1 : i32
+!CHECK: %[[VAL_18:.*]] = arith.cmpi slt, %[[VAL_15]], %[[VAL_16]] : i32
+!CHECK: %[[VAL_19:.*]] = arith.subi %[[VAL_16]], %[[VAL_15]] : i32
+!CHECK: %[[VAL_20:.*]] = arith.select %[[VAL_18]], %[[VAL_19]], %[[VAL_15]] : i32
+!CHECK: %[[VAL_21:.*]] = arith.select %[[VAL_18]], %[[VAL_14]], %[[VAL_13]] : i32
+!CHECK: %[[VAL_22:.*]] = arith.select %[[VAL_18]], %[[VAL_13]], %[[VAL_14]] : i32
+!CHECK: %[[VAL_23:.*]] = arith.subi %[[VAL_22]], %[[VAL_21]] overflow<nuw> : i32
+!CHECK: %[[VAL_24:.*]] = arith.divui %[[VAL_23]], %[[VAL_20]] : i32
+!CHECK: %[[VAL_25:.*]] = arith.addi %[[VAL_24]], %[[VAL_17]] overflow<nuw> : i32
+!CHECK: %[[VAL_26:.*]] = arith.cmpi slt, %[[VAL_22]], %[[VAL_21]] : i32
+!CHECK: %[[VAL_27:.*]] = arith.select %[[VAL_26]], %[[VAL_16]], %[[VAL_25]] : i32
+!CHECK: %[[VAL_28:.*]] = omp.new_cli
+!CHECK: omp.canonical_loop(%[[VAL_28]]) %[[VAL_29:.*]] : i32 in range(%[[VAL_27]]) {
+!CHECK: %[[VAL_30:.*]] = arith.muli %[[VAL_29]], %[[VAL_15]] : i32
+!CHECK: %[[VAL_31:.*]] = arith.addi %[[VAL_13]], %[[VAL_30]] : i32
+!CHECK: hlfir.assign %[[VAL_31]] to %[[VAL_2]]#0 : i32, !fir.ref<i32>
+!CHECK: %[[VAL_32:.*]] = fir.load %[[VAL_4]]#0 : !fir.ref<i32>
+!CHECK: %[[VAL_33:.*]] = fir.load %[[VAL_5]]#0 : !fir.ref<i32>
+!CHECK: %[[VAL_34:.*]] = fir.load %[[VAL_3]]#0 : !fir.ref<i32>
+!CHECK: %[[VAL_35:.*]] = arith.constant 0 : i32
+!CHECK: %[[VAL_36:.*]] = arith.constant 1 : i32
+!CHECK: %[[VAL_37:.*]] = arith.cmpi slt, %[[VAL_34]], %[[VAL_35]] : i32
+!CHECK: %[[VAL_38:.*]] = arith.subi %[[VAL_35]], %[[VAL_34]] : i32
+!CHECK: %[[VAL_39:.*]] = arith.select %[[VAL_37]], %[[VAL_38]], %[[VAL_34]] : i32
+!CHECK: %[[VAL_40:.*]] = arith.select %[[VAL_37]], %[[VAL_33]], %[[VAL_32]] : i32
+!CHECK: %[[VAL_41:.*]] = arith.select %[[VAL_37]], %[[VAL_32]], %[[VAL_33]] : i32
+!CHECK: %[[VAL_42:.*]] = arith.subi %[[VAL_41]], %[[VAL_40]] overflow<nuw> : i32
+!CHECK: %[[VAL_43:.*]] = arith.divui %[[VAL_42]], %[[VAL_39]] : i32
+!CHECK: %[[VAL_44:.*]] = arith.addi %[[VAL_43]], %[[VAL_36]] overflow<nuw> : i32
+!CHECK: %[[VAL_45:.*]] = arith.cmpi slt, %[[VAL_41]], %[[VAL_40]] : i32
+!CHECK: %[[VAL_46:.*]] = arith.select %[[VAL_45]], %[[VAL_35]], %[[VAL_44]] : i32
+!CHECK: %[[VAL_47:.*]] = omp.new_cli
+!CHECK: omp.canonical_loop(%[[VAL_47]]) %[[VAL_48:.*]] : i32 in range(%[[VAL_46]]) {
+!CHECK: %[[VAL_49:.*]] = arith.muli %[[VAL_48]], %[[VAL_34]] : i32
+!CHECK: %[[VAL_50:.*]] = arith.addi %[[VAL_32]], %[[VAL_49]] : i32
+!CHECK: hlfir.assign %[[VAL_50]] to %[[VAL_7]]#0 : i32, !fir.ref<i32>
+!CHECK: %[[VAL_51:.*]] = fir.load %[[VAL_2]]#0 : !fir.ref<i32>
+!CHECK: %[[VAL_52:.*]] = fir.load %[[VAL_7]]#0 : !fir.ref<i32>
+!CHECK: %[[VAL_53:.*]] = arith.addi %[[VAL_51]], %[[VAL_52]] : i32
+!CHECK: hlfir.assign %[[VAL_53]] to %[[VAL_12]]#0 : i32, !fir.ref<i32>
!CHECK: omp.terminator
!CHECK: }
-!CHECK: omp.unroll_heuristic(%[[VAL_53]])
+!CHECK: omp.unroll_heuristic(%[[VAL_47]])
!CHECK: omp.terminator
!CHECK: }
-!CHECK: omp.unroll_heuristic(%[[VAL_32]])
+!CHECK: omp.unroll_heuristic(%[[VAL_28]])
!CHECK: return
!CHECK: }
diff --git a/flang/test/Lower/OpenMP/unroll-heuristic03.f90 b/flang/test/Lower/OpenMP/unroll-heuristic03.f90
new file mode 100644
index 0000000..308c149
--- /dev/null
+++ b/flang/test/Lower/OpenMP/unroll-heuristic03.f90
@@ -0,0 +1,61 @@
+! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=51 -o - %s 2>&1 | FileCheck %s
+
+! Test implicitly privatized loop variable that is affected by unrolling.
+
+subroutine omp_unroll_heuristic03(lb, ub, inc)
+ integer res, i, lb, ub, inc
+
+ !$omp parallel
+ !$omp unroll
+ do i = lb, ub, inc
+ res = i
+ end do
+ !$omp end unroll
+ !$omp end parallel
+
+end subroutine omp_unroll_heuristic03
+
+
+! CHECK-LABEL: func.func @_QPomp_unroll_heuristic03(
+! CHECK-SAME: %[[ARG0:.*]]: !fir.ref<i32> {fir.bindc_name = "lb"},
+! CHECK-SAME: %[[ARG1:.*]]: !fir.ref<i32> {fir.bindc_name = "ub"},
+! CHECK-SAME: %[[ARG2:.*]]: !fir.ref<i32> {fir.bindc_name = "inc"}) {
+! CHECK: %[[VAL_0:.*]] = fir.dummy_scope : !fir.dscope
+! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFomp_unroll_heuristic03Ei"}
+! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_1]] {uniq_name = "_QFomp_unroll_heuristic03Ei"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
+! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[ARG2]] dummy_scope %[[VAL_0]] {uniq_name = "_QFomp_unroll_heuristic03Einc"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %[[ARG0]] dummy_scope %[[VAL_0]] {uniq_name = "_QFomp_unroll_heuristic03Elb"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+! CHECK: %[[VAL_5:.*]] = fir.alloca i32 {bindc_name = "res", uniq_name = "_QFomp_unroll_heuristic03Eres"}
+! CHECK: %[[VAL_6:.*]]:2 = hlfir.declare %[[VAL_5]] {uniq_name = "_QFomp_unroll_heuristic03Eres"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
+! CHECK: %[[VAL_7:.*]]:2 = hlfir.declare %[[ARG1]] dummy_scope %[[VAL_0]] {uniq_name = "_QFomp_unroll_heuristic03Eub"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+! CHECK: omp.parallel private(@_QFomp_unroll_heuristic03Ei_private_i32 %[[VAL_2]]#0 -> %[[VAL_8:.*]] : !fir.ref<i32>) {
+! CHECK: %[[VAL_9:.*]]:2 = hlfir.declare %[[VAL_8]] {uniq_name = "_QFomp_unroll_heuristic03Ei"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
+! CHECK: %[[VAL_10:.*]] = fir.load %[[VAL_4]]#0 : !fir.ref<i32>
+! CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_7]]#0 : !fir.ref<i32>
+! CHECK: %[[VAL_12:.*]] = fir.load %[[VAL_3]]#0 : !fir.ref<i32>
+! CHECK: %[[VAL_13:.*]] = arith.constant 0 : i32
+! CHECK: %[[VAL_14:.*]] = arith.constant 1 : i32
+! CHECK: %[[VAL_15:.*]] = arith.cmpi slt, %[[VAL_12]], %[[VAL_13]] : i32
+! CHECK: %[[VAL_16:.*]] = arith.subi %[[VAL_13]], %[[VAL_12]] : i32
+! CHECK: %[[VAL_17:.*]] = arith.select %[[VAL_15]], %[[VAL_16]], %[[VAL_12]] : i32
+! CHECK: %[[VAL_18:.*]] = arith.select %[[VAL_15]], %[[VAL_11]], %[[VAL_10]] : i32
+! CHECK: %[[VAL_19:.*]] = arith.select %[[VAL_15]], %[[VAL_10]], %[[VAL_11]] : i32
+! CHECK: %[[VAL_20:.*]] = arith.subi %[[VAL_19]], %[[VAL_18]] overflow<nuw> : i32
+! CHECK: %[[VAL_21:.*]] = arith.divui %[[VAL_20]], %[[VAL_17]] : i32
+! CHECK: %[[VAL_22:.*]] = arith.addi %[[VAL_21]], %[[VAL_14]] overflow<nuw> : i32
+! CHECK: %[[VAL_23:.*]] = arith.cmpi slt, %[[VAL_19]], %[[VAL_18]] : i32
+! CHECK: %[[VAL_24:.*]] = arith.select %[[VAL_23]], %[[VAL_13]], %[[VAL_22]] : i32
+! CHECK: %[[VAL_25:.*]] = omp.new_cli
+! CHECK: omp.canonical_loop(%[[VAL_25]]) %[[VAL_26:.*]] : i32 in range(%[[VAL_24]]) {
+! CHECK: %[[VAL_27:.*]] = arith.muli %[[VAL_26]], %[[VAL_12]] : i32
+! CHECK: %[[VAL_28:.*]] = arith.addi %[[VAL_10]], %[[VAL_27]] : i32
+! CHECK: hlfir.assign %[[VAL_28]] to %[[VAL_9]]#0 : i32, !fir.ref<i32>
+! CHECK: %[[VAL_29:.*]] = fir.load %[[VAL_9]]#0 : !fir.ref<i32>
+! CHECK: hlfir.assign %[[VAL_29]] to %[[VAL_6]]#0 : i32, !fir.ref<i32>
+! CHECK: omp.terminator
+! CHECK: }
+! CHECK: omp.unroll_heuristic(%[[VAL_25]])
+! CHECK: omp.terminator
+! CHECK: }
+! CHECK: return
+! CHECK: } \ No newline at end of file
diff --git a/flang/test/Lower/OpenMP/wsloop-simd.f90 b/flang/test/Lower/OpenMP/wsloop-simd.f90
index 49a9a52..d26e93d 100644
--- a/flang/test/Lower/OpenMP/wsloop-simd.f90
+++ b/flang/test/Lower/OpenMP/wsloop-simd.f90
@@ -7,7 +7,7 @@
subroutine do_simd_aligned(A)
use iso_c_binding
type(c_ptr) :: A
-
+
! CHECK: omp.wsloop
! CHECK-NOT: aligned({{.*}})
! CHECK-SAME: {
@@ -66,3 +66,22 @@ subroutine do_simd_reduction()
end do
!$omp end do simd
end subroutine do_simd_reduction
+
+! CHECK-LABEL: func.func @_QPdo_simd_private(
+subroutine do_simd_private()
+ integer, allocatable :: tmp
+ ! CHECK: omp.wsloop
+ ! CHECK-NEXT: omp.simd
+ ! CHECK-SAME: private(@[[PRIV_BOX_SYM:.*]] %{{.*}} -> %[[PRIV_BOX:.*]], @[[PRIV_IVAR_SYM:.*]] %{{.*}} -> %[[PRIV_IVAR:.*]] : !fir.ref<!fir.box<!fir.heap<i32>>>, !fir.ref<i32>)
+ ! CHECK-NEXT: omp.loop_nest (%[[IVAR:.*]]) : i32
+ !$omp do simd private(tmp)
+ do i=1, 10
+ ! CHECK: %[[PRIV_BOX_DECL:.*]]:2 = hlfir.declare %[[PRIV_BOX]]
+ ! CHECK: %[[PRIV_IVAR_DECL:.*]]:2 = hlfir.declare %[[PRIV_IVAR]]
+ ! CHECK: hlfir.assign %[[IVAR]] to %[[PRIV_IVAR_DECL]]#0
+ ! CHECK: %[[PRIV_BOX_LOAD:.*]] = fir.load %[[PRIV_BOX_DECL]]
+ ! CHECK: hlfir.assign %{{.*}} to %[[PRIV_BOX_DECL]]#0
+ ! CHECK: omp.yield
+ tmp = tmp + 1
+ end do
+end subroutine do_simd_private
diff --git a/flang/test/Lower/parametrized-derived-types.f90 b/flang/test/Lower/parametrized-derived-types.f90
new file mode 100644
index 0000000..97a40c9
--- /dev/null
+++ b/flang/test/Lower/parametrized-derived-types.f90
@@ -0,0 +1,19 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! XFAIL: *
+program main
+ TYPE ty(k1,k2)
+ INTEGER ,KIND::k1,k2=5
+ INTEGER::arr(k1:k2)=10
+ CHARACTER(LEN=k2)::CHARACTER
+ END TYPE ty
+ TYPE,EXTENDS(ty)::ty1(k3)
+ INTEGER,KIND ::k3=4
+ TYPE(ty(2,k3+1))::cmp_ty = ty(2,k3+1)(55,'HI')
+ END TYPE ty1
+ TYPE ty2(l1, l2)
+ !ERROR: not yet implemented: parameterized derived types
+ INTEGER,LEN ::l1,l2
+ TYPE(ty1(2,5)), ALLOCATABLE::ty1_cmp(:)
+ END TYPE ty2
+ TYPE(ty2(4,8)) ::ty2_obj
+end program main
diff --git a/flang/test/NonGtestUnit/lit.cfg.py b/flang/test/NonGtestUnit/lit.cfg.py
index 39ae19f..407b393 100644
--- a/flang/test/NonGtestUnit/lit.cfg.py
+++ b/flang/test/NonGtestUnit/lit.cfg.py
@@ -4,7 +4,7 @@ import lit.Test
config.name = "flang-OldUnit"
-config.suffixes = [".test"]
+config.suffixes = [".test", ".test.exe"]
config.test_source_root = os.path.join(config.flang_obj_root, "unittests")
config.test_exec_root = config.test_source_root
diff --git a/flang/test/Parser/OpenMP/affinity-clause.f90 b/flang/test/Parser/OpenMP/affinity-clause.f90
index 642af6a..0b96cae 100644
--- a/flang/test/Parser/OpenMP/affinity-clause.f90
+++ b/flang/test/Parser/OpenMP/affinity-clause.f90
@@ -15,8 +15,8 @@ end
!UNPARSE: !$OMP END TASK
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = task
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = task
!PARSE-TREE: | OmpClauseList -> OmpClause -> Affinity -> OmpAffinityClause
!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
@@ -34,8 +34,8 @@ end
!UNPARSE: !$OMP END TASK
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = task
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = task
!PARSE-TREE: | OmpClauseList -> OmpClause -> Affinity -> OmpAffinityClause
!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> ArrayElement
!PARSE-TREE: | | | DataRef -> Name = 'x'
@@ -60,8 +60,8 @@ end
!UNPARSE: !$OMP END TASK
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = task
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = task
!PARSE-TREE: | OmpClauseList -> OmpClause -> Affinity -> OmpAffinityClause
!PARSE-TREE: | | Modifier -> OmpIterator -> OmpIteratorSpecifier
!PARSE-TREE: | | | TypeDeclarationStmt
diff --git a/flang/test/Parser/OpenMP/allocators-unparse.f90 b/flang/test/Parser/OpenMP/allocators-unparse.f90
index 70feb7a..079d6ac 100644
--- a/flang/test/Parser/OpenMP/allocators-unparse.f90
+++ b/flang/test/Parser/OpenMP/allocators-unparse.f90
@@ -28,7 +28,7 @@ end subroutine allocate
!CHECK-NEXT: ALLOCATE(arr2(5,3))
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAllocatorsConstruct
-!PARSE-TREE-NEXT: | OmpDirectiveSpecification
+!PARSE-TREE-NEXT: | OmpBeginDirective
!PARSE-TREE-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = allocators
!PARSE-TREE-NEXT: | | OmpClauseList -> OmpClause -> Allocate -> OmpAllocateClause
!PARSE-TREE-NEXT: | | | Modifier -> OmpAllocatorSimpleModifier -> Scalar -> Integer -> Expr -> Designator -> DataRef -> Name = 'omp_default_mem_alloc'
@@ -40,7 +40,7 @@ end subroutine allocate
!PARSE-TREE-NEXT: | | | | AllocateObject -> Name = 'arr1'
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAllocatorsConstruct
-!PARSE-TREE-NEXT: | OmpDirectiveSpecification
+!PARSE-TREE-NEXT: | OmpBeginDirective
!PARSE-TREE-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = allocators
!PARSE-TREE-NEXT: | | OmpClauseList -> OmpClause -> Allocate -> OmpAllocateClause
!PARSE-TREE-NEXT: | | | Modifier -> OmpAllocatorComplexModifier -> Scalar -> Integer -> Expr -> Designator -> DataRef -> Name = 'omp_default_mem_alloc'
@@ -56,7 +56,7 @@ end subroutine allocate
!PARSE-TREE-NEXT: | | | | AllocateObject -> Name = 'arr1'
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAllocatorsConstruct
-!PARSE-TREE-NEXT: | OmpDirectiveSpecification
+!PARSE-TREE-NEXT: | OmpBeginDirective
!PARSE-TREE-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = allocators
!PARSE-TREE-NEXT: | | OmpClauseList -> OmpClause -> Allocate -> OmpAllocateClause
!PARSE-TREE-NEXT: | | | Modifier -> OmpAlignModifier -> Scalar -> Integer -> Expr -> LiteralConstant -> IntLiteralConstant = '32'
@@ -70,7 +70,7 @@ end subroutine allocate
!PARSE-TREE-NEXT: | | | | | Scalar -> Integer -> Expr -> LiteralConstant -> IntLiteralConstant = '5'
!PARSE-TREE-NEXT: | | | | AllocateShapeSpec
!PARSE-TREE-NEXT: | | | | | Scalar -> Integer -> Expr -> LiteralConstant -> IntLiteralConstant = '3'
-!PARSE-TREE-NEXT: | OmpDirectiveSpecification
+!PARSE-TREE-NEXT: | OmpEndDirective
!PARSE-TREE-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = allocators
!PARSE-TREE-NEXT: | | OmpClauseList ->
!PARSE-TREE-NEXT: | | Flags = None
diff --git a/flang/test/Parser/OpenMP/atomic-compare.f90 b/flang/test/Parser/OpenMP/atomic-compare.f90
index e09da4a..9b9c4f0 100644
--- a/flang/test/Parser/OpenMP/atomic-compare.f90
+++ b/flang/test/Parser/OpenMP/atomic-compare.f90
@@ -16,7 +16,7 @@ end
!UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct
-!PARSE-TREE: | OmpDirectiveSpecification
+!PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->
!PARSE-TREE: | | OmpClause -> Compare
@@ -54,7 +54,7 @@ end
!UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct
-!PARSE-TREE: | OmpDirectiveSpecification
+!PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->
!PARSE-TREE: | | OmpClause -> Compare
@@ -108,7 +108,7 @@ end
!PARSE-TREE: | | | Expr = 'a'
!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'a'
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct
-!PARSE-TREE: | OmpDirectiveSpecification
+!PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->
!PARSE-TREE: | | OmpClause -> Compare
@@ -145,7 +145,7 @@ end
!UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct
-!PARSE-TREE: | OmpDirectiveSpecification
+!PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->
!PARSE-TREE: | | OmpClause -> Capture
@@ -169,7 +169,7 @@ end
!PARSE-TREE: | | | | | Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | | Expr = 'b'
!PARSE-TREE: | | | | | Designator -> DataRef -> Name = 'b'
-!PARSE-TREE: | OmpDirectiveSpecification
+!PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | | Flags = None
@@ -197,7 +197,7 @@ end
!UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct
-!PARSE-TREE: | OmpDirectiveSpecification
+!PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->
!PARSE-TREE: | | OmpClause -> Capture
@@ -224,7 +224,7 @@ end
!PARSE-TREE: | | | | | Expr = 'b'
!PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'b'
!PARSE-TREE: | | | EndIfStmt ->
-!PARSE-TREE: | OmpDirectiveSpecification
+!PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | | Flags = None
@@ -254,7 +254,7 @@ end
!UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct
-!PARSE-TREE: | OmpDirectiveSpecification
+!PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->
!PARSE-TREE: | | OmpClause -> Capture
@@ -284,7 +284,7 @@ end
!PARSE-TREE: | | | | | | Expr = 'x'
!PARSE-TREE: | | | | | | | Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | EndIfStmt ->
-!PARSE-TREE: | OmpDirectiveSpecification
+!PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | | Flags = None
diff --git a/flang/test/Parser/OpenMP/atomic-end.f90 b/flang/test/Parser/OpenMP/atomic-end.f90
index e5eac87..b971bb6f 100644
--- a/flang/test/Parser/OpenMP/atomic-end.f90
+++ b/flang/test/Parser/OpenMP/atomic-end.f90
@@ -16,7 +16,7 @@ end
!UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct
-!PARSE-TREE: | OmpDirectiveSpecification
+!PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Read
!PARSE-TREE: | | Flags = None
@@ -26,7 +26,7 @@ end
!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'v'
!PARSE-TREE: | | | Expr = 'x'
!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'x'
-!PARSE-TREE: | OmpDirectiveSpecification
+!PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | | Flags = None
@@ -47,7 +47,7 @@ end
!UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct
-!PARSE-TREE: | OmpDirectiveSpecification
+!PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Read
!PARSE-TREE: | | Flags = None
@@ -57,7 +57,7 @@ end
!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'v'
!PARSE-TREE: | | | Expr = 'x'
!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'x'
-!PARSE-TREE: | OmpDirectiveSpecification
+!PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | | Flags = None
diff --git a/flang/test/Parser/OpenMP/block-construct.f90 b/flang/test/Parser/OpenMP/block-construct.f90
index 83f0f7f..ea42554 100644
--- a/flang/test/Parser/OpenMP/block-construct.f90
+++ b/flang/test/Parser/OpenMP/block-construct.f90
@@ -20,8 +20,8 @@ end
!UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
-!PARSE-TREE: | OmpBeginBlockDirective
-!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: | OmpBeginDirective
+!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | OmpObject -> Designator -> DataRef -> Name = 'y'
@@ -45,8 +45,8 @@ end
!PARSE-TREE: | | | | | | LiteralConstant -> IntLiteralConstant = '2'
!PARSE-TREE: | | | | | Expr = 'x'
!PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'x'
-!PARSE-TREE: | OmpEndBlockDirective
-!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: | OmpEndDirective
+!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList ->
@@ -72,8 +72,8 @@ end
!UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
-!PARSE-TREE: | OmpBeginBlockDirective
-!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: | OmpBeginDirective
+!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | OmpObject -> Designator -> DataRef -> Name = 'y'
@@ -129,8 +129,8 @@ end
!UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
-!PARSE-TREE: | OmpBeginBlockDirective
-!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: | OmpBeginDirective
+!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | OmpObject -> Designator -> DataRef -> Name = 'y'
@@ -160,6 +160,6 @@ end
!PARSE-TREE: | | | | | | | Expr = 'x'
!PARSE-TREE: | | | | | | | | Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | EndBlockStmt ->
-!PARSE-TREE: | OmpEndBlockDirective
-!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: | OmpEndDirective
+!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList ->
diff --git a/flang/test/Parser/OpenMP/construct-prefix-conflict.f90 b/flang/test/Parser/OpenMP/construct-prefix-conflict.f90
index 678942a..d6f5152 100644
--- a/flang/test/Parser/OpenMP/construct-prefix-conflict.f90
+++ b/flang/test/Parser/OpenMP/construct-prefix-conflict.f90
@@ -27,13 +27,13 @@ end
!UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
-!PARSE-TREE: | OmpBeginBlockDirective
-!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: | OmpBeginDirective
+!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | Block
!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
-!PARSE-TREE: | | | OmpBeginBlockDirective
-!PARSE-TREE: | | | | OmpBlockDirective -> llvm::omp::Directive = target data
+!PARSE-TREE: | | | OmpBeginDirective
+!PARSE-TREE: | | | | OmpDirectiveName -> llvm::omp::Directive = target data
!PARSE-TREE: | | | | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | | | bool = 'true'
@@ -43,11 +43,11 @@ end
!PARSE-TREE: | | | | | Expr -> Add
!PARSE-TREE: | | | | | | Expr -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1'
-!PARSE-TREE: | | | OmpEndBlockDirective
-!PARSE-TREE: | | | | OmpBlockDirective -> llvm::omp::Directive = target data
+!PARSE-TREE: | | | OmpEndDirective
+!PARSE-TREE: | | | | OmpDirectiveName -> llvm::omp::Directive = target data
!PARSE-TREE: | | | | OmpClauseList ->
-!PARSE-TREE: | OmpEndBlockDirective
-!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: | OmpEndDirective
+!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList ->
@@ -70,8 +70,8 @@ end
!UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
-!PARSE-TREE: | OmpBeginBlockDirective
-!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: | OmpBeginDirective
+!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | Block
!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct -> OmpDirectiveSpecification
@@ -85,8 +85,8 @@ end
!PARSE-TREE: | | | Expr -> Add
!PARSE-TREE: | | | | Expr -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1'
-!PARSE-TREE: | OmpEndBlockDirective
-!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: | OmpEndDirective
+!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList ->
@@ -109,8 +109,8 @@ end
!UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
-!PARSE-TREE: | OmpBeginBlockDirective
-!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: | OmpBeginDirective
+!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | Block
!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct -> OmpDirectiveSpecification
@@ -124,8 +124,8 @@ end
!PARSE-TREE: | | | Expr -> Add
!PARSE-TREE: | | | | Expr -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1'
-!PARSE-TREE: | OmpEndBlockDirective
-!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: | OmpEndDirective
+!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList ->
@@ -148,8 +148,8 @@ end
!UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
-!PARSE-TREE: | OmpBeginBlockDirective
-!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: | OmpBeginDirective
+!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | Block
!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct -> OmpDirectiveSpecification
@@ -163,6 +163,6 @@ end
!PARSE-TREE: | | | Expr -> Add
!PARSE-TREE: | | | | Expr -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1'
-!PARSE-TREE: | OmpEndBlockDirective
-!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: | OmpEndDirective
+!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList ->
diff --git a/flang/test/Parser/OpenMP/declare-target-indirect-tree.f90 b/flang/test/Parser/OpenMP/declare-target-indirect-tree.f90
index df85942..916bd66 100644
--- a/flang/test/Parser/OpenMP/declare-target-indirect-tree.f90
+++ b/flang/test/Parser/OpenMP/declare-target-indirect-tree.f90
@@ -15,7 +15,8 @@ module functions
contains
function func1() result(i)
!$omp declare target enter(func1) indirect(.true.)
- !CHECK: | | | | | OmpDeclareTargetSpecifier -> OmpDeclareTargetWithClause -> OmpClauseList -> OmpClause -> Enter -> OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'func1'
+ !CHECK: | | | | | OmpDeclareTargetSpecifier -> OmpDeclareTargetWithClause -> OmpClauseList -> OmpClause -> Enter -> OmpEnterClause
+ !CHECK-NEXT: | | | | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'func1'
!CHECK-NEXT: | | | | | OmpClause -> Indirect -> OmpIndirectClause -> Scalar -> Logical -> Expr = '.true._4'
!CHECK-NEXT: | | | | | | LiteralConstant -> LogicalLiteralConstant
!CHECK-NEXT: | | | | | | | bool = 'true'
@@ -26,7 +27,8 @@ contains
function func2() result(i)
!$omp declare target enter(func2) indirect
- !CHECK: | | | | | OmpDeclareTargetSpecifier -> OmpDeclareTargetWithClause -> OmpClauseList -> OmpClause -> Enter -> OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'func2'
+ !CHECK: | | | | | OmpDeclareTargetSpecifier -> OmpDeclareTargetWithClause -> OmpClauseList -> OmpClause -> Enter -> OmpEnterClause
+ !CHECK-NEXT: | | | | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'func2'
!CHECK-NEXT: | | | | | OmpClause -> Indirect -> OmpIndirectClause ->
character(1) :: i
i = 'b'
diff --git a/flang/test/Parser/OpenMP/defaultmap-clause.f90 b/flang/test/Parser/OpenMP/defaultmap-clause.f90
index d908258..e7825e5 100644
--- a/flang/test/Parser/OpenMP/defaultmap-clause.f90
+++ b/flang/test/Parser/OpenMP/defaultmap-clause.f90
@@ -11,8 +11,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: | | ImplicitBehavior = From
!PARSE-TREE: Block
@@ -27,8 +27,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: | | ImplicitBehavior = Firstprivate
!PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = Aggregate
@@ -43,8 +43,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: | | ImplicitBehavior = Alloc
!PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = All
@@ -61,8 +61,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: | | ImplicitBehavior = Alloc
!PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = Allocatable
@@ -77,8 +77,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: | | ImplicitBehavior = Tofrom
!PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = Scalar
@@ -93,8 +93,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: | | ImplicitBehavior = Present
!PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = Scalar
diff --git a/flang/test/Parser/OpenMP/defaultmap-unparse.f90 b/flang/test/Parser/OpenMP/defaultmap-unparse.f90
index bbbb6fc..fa05780 100644
--- a/flang/test/Parser/OpenMP/defaultmap-unparse.f90
+++ b/flang/test/Parser/OpenMP/defaultmap-unparse.f90
@@ -34,8 +34,8 @@ program main
!CHECK: !$omp end target
!$omp end target
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = Tofrom
!PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Scalar
@@ -46,8 +46,8 @@ program main
!CHECK: !$omp end target
!$omp end target
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = Alloc
!PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Scalar
@@ -58,8 +58,8 @@ program main
!CHECK: !$omp end target
!$omp end target
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = None
@@ -69,8 +69,8 @@ program main
!CHECK: !$omp end target
!$omp end target
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = None
!PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Scalar
@@ -81,8 +81,8 @@ program main
!CHECK: !$omp end target
!$omp end target
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = To
!PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Scalar
@@ -93,8 +93,8 @@ program main
!CHECK: !$omp end target
!$omp end target
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = Firstprivate
!PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Scalar
@@ -108,8 +108,8 @@ program main
!CHECK: !$omp end target
!$omp end target
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = Tofrom
!PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Aggregate
@@ -120,8 +120,8 @@ program main
!CHECK: !$omp end target
!$omp end target
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = Tofrom
!PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Allocatable
@@ -134,8 +134,8 @@ program main
!CHECK: !$omp end target
!$omp end target
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = Default
!PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Pointer
diff --git a/flang/test/Parser/OpenMP/dispatch.f90 b/flang/test/Parser/OpenMP/dispatch.f90
index 4076c00..131b4d1 100644
--- a/flang/test/Parser/OpenMP/dispatch.f90
+++ b/flang/test/Parser/OpenMP/dispatch.f90
@@ -18,7 +18,7 @@ subroutine sub(x)
!UNPARSE: !$OMP END DISPATCH
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPDispatchConstruct
-!PARSE-TREE: | OmpDirectiveSpecification
+!PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = dispatch
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: | | | Scalar -> Integer -> Expr = '3_4'
@@ -37,7 +37,7 @@ subroutine sub(x)
!PARSE-TREE: | Block
!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt
![...]
-!PARSE-TREE: | OmpDirectiveSpecification
+!PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = dispatch
!PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | | Flags = None
@@ -51,7 +51,7 @@ subroutine sub(x)
!UNPARSE: r=func(a+1_4,b+2_4,c+3_4)
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPDispatchConstruct
-!PARSE-TREE: | OmpDirectiveSpecification
+!PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = dispatch
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: | | | Scalar -> Integer -> Expr = '3_4'
@@ -60,7 +60,7 @@ subroutine sub(x)
!PARSE-TREE: | | Flags = None
!PARSE-TREE: | Block
!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt
-!PARSE-TREE-NOT: OmpDirectiveSpecification
+!PARSE-TREE-NOT: OmpEndDirective
!$omp dispatch device(3) is_device_ptr(x)
r = func(a+1, b+2, c+3)
diff --git a/flang/test/Parser/OpenMP/enter-automap-modifier.f90 b/flang/test/Parser/OpenMP/enter-automap-modifier.f90
new file mode 100644
index 0000000..1f361ca5
--- /dev/null
+++ b/flang/test/Parser/OpenMP/enter-automap-modifier.f90
@@ -0,0 +1,16 @@
+!RUN: %flang_fc1 -fdebug-unparse -fopenmp -fopenmp-version=60 %s | FileCheck %s --check-prefix=UNPARSE
+!RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=60 %s | FileCheck %s --check-prefix=PARSE-TREE
+
+program automap
+ integer :: x
+ !$omp declare target enter(automap: x)
+end program
+
+!UNPARSE: PROGRAM AUTOMAP
+!UNPARSE: INTEGER x
+!UNPARSE: !$OMP DECLARE TARGET ENTER(AUTOMAP: x)
+!UNPARSE: END PROGRAM
+
+!PARSE-TREE: OmpClauseList -> OmpClause -> Enter -> OmpEnterClause
+!PARSE-TREE-NEXT: | Modifier -> OmpAutomapModifier -> Value = Automap
+!PARSE-TREE-NEXT: | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
diff --git a/flang/test/Parser/OpenMP/if-clause.f90 b/flang/test/Parser/OpenMP/if-clause.f90
index e47fbde..2bf80cb 100644
--- a/flang/test/Parser/OpenMP/if-clause.f90
+++ b/flang/test/Parser/OpenMP/if-clause.f90
@@ -24,7 +24,7 @@ program openmp_parse_if
! CHECK-NEXT: OmpDirectiveName -> llvm::omp::Directive = target exit data
!$omp target exit data map(from: i) if(target exit data: cond)
- ! CHECK: OmpBlockDirective -> llvm::omp::Directive = target data
+ ! CHECK: OmpDirectiveName -> llvm::omp::Directive = target data
! CHECK: OmpClause -> If -> OmpIfClause
! CHECK-NEXT: OmpDirectiveName -> llvm::omp::Directive = target data
!$omp target data map(tofrom: i) if(target data: cond)
@@ -45,7 +45,7 @@ program openmp_parse_if
end do
!$omp end target teams distribute parallel do simd
- ! CHECK: OmpBlockDirective -> llvm::omp::Directive = task
+ ! CHECK: OmpDirectiveName -> llvm::omp::Directive = task
! CHECK-NEXT: OmpClause -> If -> OmpIfClause
! CHECK-NEXT: OmpDirectiveName -> llvm::omp::Directive = task
!$omp task if(task: cond)
diff --git a/flang/test/Parser/OpenMP/in-reduction-clause.f90 b/flang/test/Parser/OpenMP/in-reduction-clause.f90
index bb3fadb..ee59069 100644
--- a/flang/test/Parser/OpenMP/in-reduction-clause.f90
+++ b/flang/test/Parser/OpenMP/in-reduction-clause.f90
@@ -29,13 +29,13 @@ subroutine omp_in_reduction_taskgroup()
end subroutine omp_in_reduction_taskgroup
!PARSE-TREE: OpenMPConstruct -> OpenMPBlockConstruct
-!PARSE-TREE-NEXT: OmpBeginBlockDirective
-!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = taskgroup
+!PARSE-TREE-NEXT: OmpBeginDirective
+!PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = taskgroup
!PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> TaskReduction -> OmpTaskReductionClause
!PARSE-TREE: OpenMPConstruct -> OpenMPBlockConstruct
-!PARSE-TREE-NEXT: OmpBeginBlockDirective
-!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = task
+!PARSE-TREE-NEXT: OmpBeginDirective
+!PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = task
!PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> InReduction -> OmpInReductionClause
!PARSE-TREE-NEXT: OmpReductionIdentifier -> DefinedOperator -> IntrinsicOperator = Add
!PARSE-TREE-NEXT: OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'z'
@@ -66,8 +66,8 @@ subroutine omp_in_reduction_parallel()
end subroutine omp_in_reduction_parallel
!PARSE-TREE: OpenMPConstruct -> OpenMPBlockConstruct
-!PARSE-TREE-NEXT: OmpBeginBlockDirective
-!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = parallel
+!PARSE-TREE-NEXT: OmpBeginDirective
+!PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = parallel
!PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Reduction -> OmpReductionClause
!PARSE-TREE: OpenMPConstruct -> OpenMPLoopConstruct
diff --git a/flang/test/Parser/OpenMP/map-modifiers-v60.f90 b/flang/test/Parser/OpenMP/map-modifiers-v60.f90
index bc80886..46d57a0 100644
--- a/flang/test/Parser/OpenMP/map-modifiers-v60.f90
+++ b/flang/test/Parser/OpenMP/map-modifiers-v60.f90
@@ -15,8 +15,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpAlwaysModifier -> Value = Always
!PARSE-TREE: | | Modifier -> OmpCloseModifier -> Value = Close
@@ -38,8 +38,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpSelfModifier -> Value = Self
!PARSE-TREE: | | Modifier -> OmpMapType -> Value = Storage
@@ -60,8 +60,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpRefModifier -> Value = Ref_Ptr
!PARSE-TREE: | | Modifier -> OmpMapType -> Value = To
@@ -82,8 +82,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpRefModifier -> Value = Ref_Ptee
!PARSE-TREE: | | Modifier -> OmpMapType -> Value = To
@@ -104,8 +104,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpRefModifier -> Value = Ref_Ptr_Ptee
!PARSE-TREE: | | Modifier -> OmpMapType -> Value = To
diff --git a/flang/test/Parser/OpenMP/map-modifiers.f90 b/flang/test/Parser/OpenMP/map-modifiers.f90
index 4e034e5..83662b7 100644
--- a/flang/test/Parser/OpenMP/map-modifiers.f90
+++ b/flang/test/Parser/OpenMP/map-modifiers.f90
@@ -15,8 +15,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Ompx_Hold
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Always
@@ -40,8 +40,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Ompx_Hold
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Always
@@ -64,8 +64,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapType -> Value = From
!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
@@ -85,8 +85,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | bool = 'true'
@@ -105,8 +105,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Ompx_Hold
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Always
@@ -130,8 +130,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Ompx_Hold
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Always
@@ -155,8 +155,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Present
!PARSE-TREE: | | Modifier -> OmpIterator -> OmpIteratorSpecifier
@@ -190,8 +190,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Present
!PARSE-TREE: | | Modifier -> OmpIterator -> OmpIteratorSpecifier
@@ -225,8 +225,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Present
!PARSE-TREE: | | Modifier -> OmpIterator -> OmpIteratorSpecifier
@@ -283,8 +283,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Present
!PARSE-TREE: | | Modifier -> OmpIterator -> OmpIteratorSpecifier
@@ -334,8 +334,8 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapper -> Name = 'xx'
!PARSE-TREE: | | Modifier -> OmpMapType -> Value = From
@@ -355,7 +355,7 @@ end
!UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | Modifier -> OmpMapTypeModifier -> Value = Present
!PARSE-TREE: | Modifier -> OmpIterator -> OmpIteratorSpecifier
diff --git a/flang/test/Parser/OpenMP/masked-unparse.f90 b/flang/test/Parser/OpenMP/masked-unparse.f90
index 16d7ca6..46ddd37 100644
--- a/flang/test/Parser/OpenMP/masked-unparse.f90
+++ b/flang/test/Parser/OpenMP/masked-unparse.f90
@@ -6,14 +6,14 @@
subroutine test_masked()
integer :: c = 1
- !PARSE-TREE: OmpBeginBlockDirective
- !PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = masked
+ !PARSE-TREE: OmpBeginDirective
+ !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = masked
!CHECK: !$omp masked
!$omp masked
c = c + 1
!$omp end masked
- !PARSE-TREE: OmpBeginBlockDirective
- !PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = masked
+ !PARSE-TREE: OmpBeginDirective
+ !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = masked
!PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Filter -> Scalar -> Integer -> Expr = '1_4'
!PARSE-TREE-NEXT: LiteralConstant -> IntLiteralConstant = '1'
!CHECK: !$omp masked filter(1_4)
@@ -51,8 +51,8 @@ end subroutine
subroutine test_parallel_masked
integer, parameter :: i = 1, j = 1
integer :: c = 2
- !PARSE-TREE: OmpBeginBlockDirective
- !PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = parallel masked
+ !PARSE-TREE: OmpBeginDirective
+ !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = parallel masked
!PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Filter -> Scalar -> Integer -> Expr = '2_4'
!PARSE-TREE-NEXT: Add
!PARSE-TREE-NEXT: Expr = '1_4'
diff --git a/flang/test/Parser/OpenMP/master-unparse.f90 b/flang/test/Parser/OpenMP/master-unparse.f90
index 30c293a..ec7a7d3 100644
--- a/flang/test/Parser/OpenMP/master-unparse.f90
+++ b/flang/test/Parser/OpenMP/master-unparse.f90
@@ -6,8 +6,8 @@
subroutine test_master()
integer :: c = 1
- !PARSE-TREE: OmpBeginBlockDirective
- !PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = master
+ !PARSE-TREE: OmpBeginDirective
+ !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = master
!CHECK: !$omp master
!$omp master
c = c + 1
@@ -40,8 +40,8 @@ end subroutine
subroutine test_parallel_master
integer :: c = 2
- !PARSE-TREE: OmpBeginBlockDirective
- !PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = parallel master
+ !PARSE-TREE: OmpBeginDirective
+ !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = parallel master
!CHECK: !$omp parallel master
!$omp parallel master
c = c + 2
diff --git a/flang/test/Parser/OpenMP/openmp6-directive-spellings.f90 b/flang/test/Parser/OpenMP/openmp6-directive-spellings.f90
index 6a1d565..69a0de6 100644
--- a/flang/test/Parser/OpenMP/openmp6-directive-spellings.f90
+++ b/flang/test/Parser/OpenMP/openmp6-directive-spellings.f90
@@ -170,14 +170,14 @@ end
!UNPARSE: SUBROUTINE f06
!UNPARSE: IMPLICIT NONE
!UNPARSE: INTEGER i
-!UNPARSE: !$OMP TARGET DATA MAP(TOFROM: i)
+!UNPARSE: !$OMP TARGET_DATA MAP(TOFROM: i)
!UNPARSE: i=0_4
-!UNPARSE: !$OMP END TARGET DATA
+!UNPARSE: !$OMP END TARGET_DATA
!UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
-!PARSE-TREE: | OmpBeginBlockDirective
-!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target data
+!PARSE-TREE: | OmpBeginDirective
+!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target data
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | | Modifier -> OmpMapType -> Value = Tofrom
!PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'i'
@@ -188,8 +188,8 @@ end
!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'i'
!PARSE-TREE: | | | Expr = '0_4'
!PARSE-TREE: | | | | LiteralConstant -> IntLiteralConstant = '0'
-!PARSE-TREE: | OmpEndBlockDirective
-!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target data
+!PARSE-TREE: | OmpEndDirective
+!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target data
!PARSE-TREE: | | OmpClauseList ->
subroutine f07
diff --git a/flang/test/Parser/OpenMP/proc-bind.f90 b/flang/test/Parser/OpenMP/proc-bind.f90
index 3115b37..98ce39e 100644
--- a/flang/test/Parser/OpenMP/proc-bind.f90
+++ b/flang/test/Parser/OpenMP/proc-bind.f90
@@ -4,8 +4,8 @@
! CHECK: !$OMP PARALLEL PROC_BIND(PRIMARY)
! PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
-! PARSE-TREE: OmpBeginBlockDirective
-! PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = parallel
+! PARSE-TREE: OmpBeginDirective
+! PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = parallel
! PARSE-TREE: OmpClauseList -> OmpClause -> ProcBind -> OmpProcBindClause -> AffinityPolicy = Primary
subroutine sb1
!$omp parallel proc_bind(primary)
diff --git a/flang/test/Parser/OpenMP/scope.f90 b/flang/test/Parser/OpenMP/scope.f90
index 6574136..9e046d6 100644
--- a/flang/test/Parser/OpenMP/scope.f90
+++ b/flang/test/Parser/OpenMP/scope.f90
@@ -9,13 +9,13 @@ program omp_scope
!CHECK: !$OMP END SCOPE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = scope
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = scope
!PARSE-TREE: OmpClauseList -> OmpClause -> Private -> OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'i'
!PARSE-TREE: Block
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> PrintStmt
-!PARSE-TREE: OmpEndBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = scope
+!PARSE-TREE: OmpEndDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = scope
!PARSE-TREE: OmpClauseList -> OmpClause -> Nowait
!$omp scope private(i)
diff --git a/flang/test/Parser/OpenMP/sections.f90 b/flang/test/Parser/OpenMP/sections.f90
index 3752cef..8ba2294 100644
--- a/flang/test/Parser/OpenMP/sections.f90
+++ b/flang/test/Parser/OpenMP/sections.f90
@@ -10,32 +10,41 @@ subroutine openmp_sections(x, y)
!==============================================================================
!CHECK: !$omp sections
!$omp sections
- !CHECK: !$omp section
!CHECK: !$omp end sections
!$omp end sections
-!PARSE-TREE: OpenMPConstruct -> OpenMPSectionsConstruct
-!PARSE-TREE: OmpBeginSectionsDirective
-!PARSE-TREE-NOT: ExecutionPartConstruct
-!PARSE-TREE: OmpEndSectionsDirective
+!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPSectionsConstruct
+!PARSE-TREE: | OmpBeginSectionsDirective
+!PARSE-TREE: | | OmpSectionsDirective -> llvm::omp::Directive = sections
+!PARSE-TREE: | | OmpClauseList ->
+!PARSE-TREE: | OpenMPConstruct -> OpenMPSectionConstruct
+!PARSE-TREE: | | Block
+!PARSE-TREE: | OmpEndSectionsDirective
+!PARSE-TREE: | | OmpSectionsDirective -> llvm::omp::Directive = sections
+!PARSE-TREE: | | OmpClauseList ->
!==============================================================================
! single section, without `!$omp section`
!==============================================================================
!CHECK: !$omp sections
!$omp sections
- !CHECK: !$omp section
!CHECK: CALL
call F1()
!CHECK: !$omp end sections
!$omp end sections
-!PARSE-TREE: OpenMPConstruct -> OpenMPSectionsConstruct
-!PARSE-TREE: OmpBeginSectionsDirective
-!PARSE-TREE: OpenMPConstruct -> OpenMPSectionConstruct -> Block
-!PARSE-TREE: CallStmt
-!PARSE-TREE-NOT: ExecutionPartConstruct
-!PARSE-TREE: OmpEndSectionsDirective
+!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPSectionsConstruct
+!PARSE-TREE: | OmpBeginSectionsDirective
+!PARSE-TREE: | | OmpSectionsDirective -> llvm::omp::Directive = sections
+!PARSE-TREE: | | OmpClauseList ->
+!PARSE-TREE: | OpenMPConstruct -> OpenMPSectionConstruct
+!PARSE-TREE: | | Block
+!PARSE-TREE: | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> CallStmt = 'CALL f1()'
+!PARSE-TREE: | | | | Call
+!PARSE-TREE: | | | | | ProcedureDesignator -> Name = 'f1'
+!PARSE-TREE: | OmpEndSectionsDirective
+!PARSE-TREE: | | OmpSectionsDirective -> llvm::omp::Directive = sections
+!PARSE-TREE: | | OmpClauseList ->
!==============================================================================
! single section with `!$omp section`
@@ -49,12 +58,22 @@ subroutine openmp_sections(x, y)
!CHECK: !$omp end sections
!$omp end sections
-!PARSE-TREE: OpenMPConstruct -> OpenMPSectionsConstruct
-!PARSE-TREE: OmpBeginSectionsDirective
-!PARSE-TREE: OpenMPConstruct -> OpenMPSectionConstruct -> Block
-!PARSE-TREE: CallStmt
-!PARSE-TREE-NOT: ExecutionPartConstruct
-!PARSE-TREE: OmpEndSectionsDirective
+!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPSectionsConstruct
+!PARSE-TREE: | OmpBeginSectionsDirective
+!PARSE-TREE: | | OmpSectionsDirective -> llvm::omp::Directive = sections
+!PARSE-TREE: | | OmpClauseList ->
+!PARSE-TREE: | OpenMPConstruct -> OpenMPSectionConstruct
+!PARSE-TREE: | | OmpDirectiveSpecification
+!PARSE-TREE: | | | OmpDirectiveName -> llvm::omp::Directive = section
+!PARSE-TREE: | | | OmpClauseList ->
+!PARSE-TREE: | | | Flags = None
+!PARSE-TREE: | | Block
+!PARSE-TREE: | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> CallStmt = 'CALL f1()'
+!PARSE-TREE: | | | | Call
+!PARSE-TREE: | | | | | ProcedureDesignator -> Name = 'f1'
+!PARSE-TREE: | OmpEndSectionsDirective
+!PARSE-TREE: | | OmpSectionsDirective -> llvm::omp::Directive = sections
+!PARSE-TREE: | | OmpClauseList ->
!==============================================================================
! multiple sections
@@ -76,16 +95,40 @@ subroutine openmp_sections(x, y)
!CHECK: !$omp end sections
!$omp end sections
-!PARSE-TREE: OpenMPConstruct -> OpenMPSectionsConstruct
-!PARSE-TREE: OmpBeginSectionsDirective
-!PARSE-TREE: OpenMPConstruct -> OpenMPSectionConstruct -> Block
-!PARSE-TREE: CallStmt
-!PARSE-TREE: OpenMPConstruct -> OpenMPSectionConstruct -> Block
-!PARSE-TREE: CallStmt
-!PARSE-TREE: OpenMPConstruct -> OpenMPSectionConstruct -> Block
-!PARSE-TREE: CallStmt
-!PARSE-TREE-NOT: ExecutionPartConstruct
-!PARSE-TREE: OmpEndSectionsDirective
+!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPSectionsConstruct
+!PARSE-TREE: | OmpBeginSectionsDirective
+!PARSE-TREE: | | OmpSectionsDirective -> llvm::omp::Directive = sections
+!PARSE-TREE: | | OmpClauseList ->
+!PARSE-TREE: | OpenMPConstruct -> OpenMPSectionConstruct
+!PARSE-TREE: | | OmpDirectiveSpecification
+!PARSE-TREE: | | | OmpDirectiveName -> llvm::omp::Directive = section
+!PARSE-TREE: | | | OmpClauseList ->
+!PARSE-TREE: | | | Flags = None
+!PARSE-TREE: | | Block
+!PARSE-TREE: | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> CallStmt = 'CALL f1()'
+!PARSE-TREE: | | | | Call
+!PARSE-TREE: | | | | | ProcedureDesignator -> Name = 'f1'
+!PARSE-TREE: | OpenMPConstruct -> OpenMPSectionConstruct
+!PARSE-TREE: | | OmpDirectiveSpecification
+!PARSE-TREE: | | | OmpDirectiveName -> llvm::omp::Directive = section
+!PARSE-TREE: | | | OmpClauseList ->
+!PARSE-TREE: | | | Flags = None
+!PARSE-TREE: | | Block
+!PARSE-TREE: | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> CallStmt = 'CALL f2()'
+!PARSE-TREE: | | | | Call
+!PARSE-TREE: | | | | | ProcedureDesignator -> Name = 'f2'
+!PARSE-TREE: | OpenMPConstruct -> OpenMPSectionConstruct
+!PARSE-TREE: | | OmpDirectiveSpecification
+!PARSE-TREE: | | | OmpDirectiveName -> llvm::omp::Directive = section
+!PARSE-TREE: | | | OmpClauseList ->
+!PARSE-TREE: | | | Flags = None
+!PARSE-TREE: | | Block
+!PARSE-TREE: | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> CallStmt = 'CALL f3()'
+!PARSE-TREE: | | | | Call
+!PARSE-TREE: | | | | | ProcedureDesignator -> Name = 'f3'
+!PARSE-TREE: | OmpEndSectionsDirective
+!PARSE-TREE: | | OmpSectionsDirective -> llvm::omp::Directive = sections
+!PARSE-TREE: | | OmpClauseList ->
!==============================================================================
! multiple sections with clauses
@@ -107,15 +150,40 @@ subroutine openmp_sections(x, y)
!CHECK: !$omp end sections NOWAIT
!$omp end sections NOWAIT
-!PARSE-TREE: OpenMPConstruct -> OpenMPSectionsConstruct
-!PARSE-TREE: OmpBeginSectionsDirective
-!PARSE-TREE: OpenMPConstruct -> OpenMPSectionConstruct -> Block
-!PARSE-TREE: CallStmt
-!PARSE-TREE: OpenMPConstruct -> OpenMPSectionConstruct -> Block
-!PARSE-TREE: CallStmt
-!PARSE-TREE: OpenMPConstruct -> OpenMPSectionConstruct -> Block
-!PARSE-TREE: CallStmt
-!PARSE-TREE-NOT: ExecutionPartConstruct
-!PARSE-TREE: OmpEndSectionsDirective
+!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPSectionsConstruct
+!PARSE-TREE: | OmpBeginSectionsDirective
+!PARSE-TREE: | | OmpSectionsDirective -> llvm::omp::Directive = sections
+!PARSE-TREE: | | OmpClauseList -> OmpClause -> Private -> OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
+!PARSE-TREE: | | OmpClause -> Firstprivate -> OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'y'
+!PARSE-TREE: | OpenMPConstruct -> OpenMPSectionConstruct
+!PARSE-TREE: | | OmpDirectiveSpecification
+!PARSE-TREE: | | | OmpDirectiveName -> llvm::omp::Directive = section
+!PARSE-TREE: | | | OmpClauseList ->
+!PARSE-TREE: | | | Flags = None
+!PARSE-TREE: | | Block
+!PARSE-TREE: | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> CallStmt = 'CALL f1()'
+!PARSE-TREE: | | | | Call
+!PARSE-TREE: | | | | | ProcedureDesignator -> Name = 'f1'
+!PARSE-TREE: | OpenMPConstruct -> OpenMPSectionConstruct
+!PARSE-TREE: | | OmpDirectiveSpecification
+!PARSE-TREE: | | | OmpDirectiveName -> llvm::omp::Directive = section
+!PARSE-TREE: | | | OmpClauseList ->
+!PARSE-TREE: | | | Flags = None
+!PARSE-TREE: | | Block
+!PARSE-TREE: | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> CallStmt = 'CALL f2()'
+!PARSE-TREE: | | | | Call
+!PARSE-TREE: | | | | | ProcedureDesignator -> Name = 'f2'
+!PARSE-TREE: | OpenMPConstruct -> OpenMPSectionConstruct
+!PARSE-TREE: | | OmpDirectiveSpecification
+!PARSE-TREE: | | | OmpDirectiveName -> llvm::omp::Directive = section
+!PARSE-TREE: | | | OmpClauseList ->
+!PARSE-TREE: | | | Flags = None
+!PARSE-TREE: | | Block
+!PARSE-TREE: | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> CallStmt = 'CALL f3()'
+!PARSE-TREE: | | | | Call
+!PARSE-TREE: | | | | | ProcedureDesignator -> Name = 'f3'
+!PARSE-TREE: | OmpEndSectionsDirective
+!PARSE-TREE: | | OmpSectionsDirective -> llvm::omp::Directive = sections
+!PARSE-TREE: | | OmpClauseList -> OmpClause -> Nowait
END subroutine openmp_sections
diff --git a/flang/test/Parser/OpenMP/target_device_parse.f90 b/flang/test/Parser/OpenMP/target_device_parse.f90
index 7f5bee3..d3c9c69 100644
--- a/flang/test/Parser/OpenMP/target_device_parse.f90
+++ b/flang/test/Parser/OpenMP/target_device_parse.f90
@@ -20,13 +20,13 @@ PROGRAM main
!CHECK: !$OMP END TARGET
!$OMP END TARGET
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: Scalar -> Integer -> Expr = '1_4'
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1'
-!PARSE-TREE: OmpEndBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpEndDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList ->
!------------------------------------------------------
@@ -38,8 +38,8 @@ PROGRAM main
!CHECK: !$OMP END TARGET
!$OMP END TARGET
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: Scalar -> Integer -> Expr = '1_4'
!PARSE-TREE: Subtract
@@ -47,8 +47,8 @@ PROGRAM main
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '2'
!PARSE-TREE: Expr = '1_4'
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1'
-!PARSE-TREE: OmpEndBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpEndDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList ->
@@ -61,13 +61,13 @@ PROGRAM main
!CHECK: !$OMP END TARGET
!$OMP END TARGET
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: Scalar -> Integer -> Expr = 'x'
!PARSE-TREE: Designator -> DataRef -> Name = 'x'
-!PARSE-TREE: OmpEndBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpEndDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList ->
@@ -80,8 +80,8 @@ PROGRAM main
!CHECK: !$OMP END TARGET
!$OMP END TARGET
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: Scalar -> Integer -> Expr = 'x+y'
!PARSE-TREE: Add
@@ -89,8 +89,8 @@ PROGRAM main
!PARSE-TREE: Designator -> DataRef -> Name = 'x'
!PARSE-TREE: Expr = 'y'
!PARSE-TREE: Designator -> DataRef -> Name = 'y'
-!PARSE-TREE: OmpEndBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpEndDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList ->
!------------------------------------------------------
@@ -102,14 +102,14 @@ PROGRAM main
!CHECK: !$OMP END TARGET
!$OMP END TARGET
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: OmpDeviceModifier -> Value = Ancestor
!PARSE-TREE: Scalar -> Integer -> Expr = '1_4'
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1'
-!PARSE-TREE: OmpEndBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpEndDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList ->
@@ -122,14 +122,14 @@ PROGRAM main
!CHECK: !$OMP END TARGET
!$OMP END TARGET
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: OmpDeviceModifier -> Value = Device_Num
!PARSE-TREE: Scalar -> Integer -> Expr = '2_4'
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '2'
-!PARSE-TREE: OmpEndBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpEndDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList ->
@@ -142,8 +142,8 @@ PROGRAM main
!CHECK: !$OMP END TARGET
!$OMP END TARGET
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: OmpDeviceModifier -> Value = Ancestor
!PARSE-TREE: Scalar -> Integer -> Expr = 'x+y'
@@ -152,8 +152,8 @@ PROGRAM main
!PARSE-TREE: Designator -> DataRef -> Name = 'x'
!PARSE-TREE: Expr = 'y'
!PARSE-TREE: Designator -> DataRef -> Name = 'y'
-!PARSE-TREE: OmpEndBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpEndDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList ->
@@ -166,8 +166,8 @@ PROGRAM main
!CHECK: !$OMP END TARGET
!$OMP END TARGET
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: OmpDeviceModifier -> Value = Device_Num
!PARSE-TREE: Scalar -> Integer -> Expr = 'x-y'
@@ -176,6 +176,6 @@ PROGRAM main
!PARSE-TREE: Designator -> DataRef -> Name = 'x'
!PARSE-TREE: Expr = 'y'
!PARSE-TREE: Designator -> DataRef -> Name = 'y'
-!PARSE-TREE: OmpEndBlockDirective
-!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
+!PARSE-TREE: OmpEndDirective
+!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
END PROGRAM
diff --git a/flang/test/Parser/OpenMP/task-reduction-clause.f90 b/flang/test/Parser/OpenMP/task-reduction-clause.f90
index 248ff791..e3e6962 100644
--- a/flang/test/Parser/OpenMP/task-reduction-clause.f90
+++ b/flang/test/Parser/OpenMP/task-reduction-clause.f90
@@ -15,8 +15,8 @@ end
!UNPARSE: !$OMP END TASKGROUP
!UNPARSE: END SUBROUTINE
-!PARSE-TREE: OmpBeginBlockDirective
-!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = taskgroup
+!PARSE-TREE: OmpBeginDirective
+!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = taskgroup
!PARSE-TREE: | OmpClauseList -> OmpClause -> TaskReduction -> OmpTaskReductionClause
!PARSE-TREE: | | Modifier -> OmpReductionIdentifier -> DefinedOperator -> IntrinsicOperator = Add
!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
diff --git a/flang/test/Parser/OpenMP/task.f90 b/flang/test/Parser/OpenMP/task.f90
index 706deb3..d6508df 100644
--- a/flang/test/Parser/OpenMP/task.f90
+++ b/flang/test/Parser/OpenMP/task.f90
@@ -2,7 +2,7 @@
! RUN: %flang_fc1 %openmp_flags -fdebug-dump-parse-tree -fopenmp -fopenmp-version=50 %s | FileCheck --ignore-case %s
! RUN: %flang_fc1 %openmp_flags -fdebug-unparse -fopenmp -fopenmp-version=50 %s | FileCheck --ignore-case --check-prefix="CHECK-UNPARSE" %s
-!CHECK: OmpBlockDirective -> llvm::omp::Directive = task
+!CHECK: OmpDirectiveName -> llvm::omp::Directive = task
!CHECK: OmpClauseList -> OmpClause -> Detach -> OmpDetachClause -> OmpObject -> Designator -> DataRef -> Name = 'event'
!CHECK-UNPARSE: INTEGER(KIND=8_4) event
diff --git a/flang/test/Semantics/OpenACC/acc-atomic-validity.f90 b/flang/test/Semantics/OpenACC/acc-atomic-validity.f90
index 07fb864..5c8d33f 100644
--- a/flang/test/Semantics/OpenACC/acc-atomic-validity.f90
+++ b/flang/test/Semantics/OpenACC/acc-atomic-validity.f90
@@ -54,11 +54,38 @@ program openacc_atomic_validity
i = c(i)
!$acc end atomic
+ !TODO: Should error because c(i) references i which is the atomic update variable.
!$acc atomic capture
c(i) = i
i = i + 1
!$acc end atomic
+ !ERROR: The variables assigned in this atomic capture construct must be distinct
+ !$acc atomic capture
+ c(1) = c(2)
+ c(1) = c(3)
+ !$acc end atomic
+
+ !ERROR: The assignments in this atomic capture construct do not update a variable and capture either its initial or final value
+ !$acc atomic capture
+ c(1) = c(2)
+ c(2) = c(2)
+ !$acc end atomic
+
+ !ERROR: The assignments in this atomic capture construct do not update a variable and capture either its initial or final value
+ !$acc atomic capture
+ c(1) = c(2)
+ c(2) = c(1)
+ !$acc end atomic
+
+ !ERROR: The assignments in this atomic capture construct do not update a variable and capture either its initial or final value
+ !$acc atomic capture
+ c(1) = c(2)
+ c(3) = c(2)
+ !$acc end atomic
+
+
+
!$acc atomic capture if(l .EQV. .false.)
c(i) = i
i = i + 1
@@ -79,3 +106,45 @@ program openacc_atomic_validity
!$acc end parallel
end program openacc_atomic_validity
+
+subroutine capture_with_convert_f64_to_i32()
+ integer :: x
+ real(8) :: v, w
+ x = 1
+ v = 0
+ w = 2
+
+ !$acc atomic capture
+ x = x * 2.5_8
+ v = x
+ !$acc end atomic
+
+ !$acc atomic capture
+ !TODO: The rhs side of this update statement cannot reference v.
+ x = x * v
+ v = x
+ !$acc end atomic
+
+ !$acc atomic capture
+ !TODO: The rhs side of this update statement cannot reference v.
+ x = v * x
+ v = x
+ !$acc end atomic
+
+ !$acc atomic capture
+ !ERROR: The RHS of this atomic update statement must reference the updated variable: x
+ x = v * v
+ v = x
+ !$acc end atomic
+
+ !$acc atomic capture
+ x = v
+ !ERROR: The updated variable, v, cannot appear more than once in the atomic update operation
+ v = v * v
+ !$acc end atomic
+
+ !$acc atomic capture
+ v = x
+ x = w * w
+ !$acc end atomic
+end subroutine capture_with_convert_f64_to_i32 \ No newline at end of file
diff --git a/flang/test/Semantics/OpenACC/acc-default-none-function.f90 b/flang/test/Semantics/OpenACC/acc-default-none-function.f90
new file mode 100644
index 0000000..f0a697f
--- /dev/null
+++ b/flang/test/Semantics/OpenACC/acc-default-none-function.f90
@@ -0,0 +1,20 @@
+! RUN: %python %S/../test_errors.py %s %flang -fopenacc -pedantic
+
+module mm_acc_rout_function
+contains
+ integer function dosomething(res)
+ !$acc routine seq
+ integer :: res
+ dosomething = res + 1
+ end function
+end module
+
+program main
+ use mm_acc_rout_function
+ implicit none
+ integer :: res = 1
+ !$acc serial default(none) copy(res)
+ res = dosomething(res)
+ !$acc end serial
+end program
+
diff --git a/flang/test/Semantics/OpenMP/atomic04.f90 b/flang/test/Semantics/OpenMP/atomic04.f90
index fb87ca5..8f8af31 100644
--- a/flang/test/Semantics/OpenMP/atomic04.f90
+++ b/flang/test/Semantics/OpenMP/atomic04.f90
@@ -180,7 +180,7 @@ subroutine more_invalid_atomic_update_stmts()
x = x
!$omp atomic update
- !ERROR: The atomic variable x should appear as an argument in the update operation
+ !ERROR: This is not a valid ATOMIC UPDATE operation
x = 1
!$omp atomic update
diff --git a/flang/test/Semantics/OpenMP/atomic05.f90 b/flang/test/Semantics/OpenMP/atomic05.f90
index 77ffc6e..e0103be 100644
--- a/flang/test/Semantics/OpenMP/atomic05.f90
+++ b/flang/test/Semantics/OpenMP/atomic05.f90
@@ -19,7 +19,7 @@ program OmpAtomic
x = 2 * 4
!ERROR: At most one clause from the 'memory-order' group is allowed on ATOMIC construct
!$omp atomic update release, seq_cst
- !ERROR: The atomic variable x should appear as an argument in the update operation
+ !ERROR: This is not a valid ATOMIC UPDATE operation
x = 10
!ERROR: At most one clause from the 'memory-order' group is allowed on ATOMIC construct
!$omp atomic capture release, seq_cst
diff --git a/flang/test/Semantics/OpenMP/clause-validity01.f90 b/flang/test/Semantics/OpenMP/clause-validity01.f90
index bc13718..e725e26 100644
--- a/flang/test/Semantics/OpenMP/clause-validity01.f90
+++ b/flang/test/Semantics/OpenMP/clause-validity01.f90
@@ -163,8 +163,7 @@ use omp_lib
!$omp parallel
do i = 1, N
enddo
- !ERROR: Unmatched END TARGET directive
- !$omp end target
+ !$omp end parallel
! OMP 5.0 - 2.6 Restriction point 1
outofparallel: do k =1, 10
diff --git a/flang/test/Semantics/OpenMP/if-clause-45.f90 b/flang/test/Semantics/OpenMP/if-clause-45.f90
new file mode 100644
index 0000000..b0b0a243
--- /dev/null
+++ b/flang/test/Semantics/OpenMP/if-clause-45.f90
@@ -0,0 +1,675 @@
+! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=45
+! Check OpenMP 'if' clause validity for all directives that can have it with OpenMP 45
+
+program main
+ integer :: i
+
+ ! ----------------------------------------------------------------------------
+ ! DISTRIBUTE PARALLEL DO
+ ! ----------------------------------------------------------------------------
+ !$omp teams
+ !$omp distribute parallel do if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end distribute parallel do
+
+ !$omp distribute parallel do if(parallel: .true.)
+ do i = 1, 10
+ end do
+ !$omp end distribute parallel do
+
+ !ERROR: TARGET is not a constituent of the DISTRIBUTE PARALLEL DO directive
+ !$omp distribute parallel do if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end distribute parallel do
+
+ !ERROR: At most one IF clause can appear on the DISTRIBUTE PARALLEL DO directive
+ !$omp distribute parallel do if(.true.) if(parallel: .false.)
+ do i = 1, 10
+ end do
+ !$omp end distribute parallel do
+ !$omp end teams
+
+ ! ----------------------------------------------------------------------------
+ ! DISTRIBUTE PARALLEL DO SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp teams
+ !$omp distribute parallel do simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end distribute parallel do simd
+
+ !ERROR: SIMD is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=50
+ !$omp distribute parallel do simd if(parallel: .true.) if(simd: .false.)
+ do i = 1, 10
+ end do
+ !$omp end distribute parallel do simd
+
+ !ERROR: TARGET is not a constituent of the DISTRIBUTE PARALLEL DO SIMD directive
+ !$omp distribute parallel do simd if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end distribute parallel do simd
+ !$omp end teams
+
+ ! ----------------------------------------------------------------------------
+ ! DISTRIBUTE SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp teams
+ !ERROR: IF clause is not allowed on directive DISTRIBUTE SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !$omp distribute simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end distribute simd
+
+ !ERROR: IF clause is not allowed on directive DISTRIBUTE SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !ERROR: SIMD is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=50
+ !$omp distribute simd if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end distribute simd
+
+ !ERROR: IF clause is not allowed on directive DISTRIBUTE SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !ERROR: TARGET is not a constituent of the DISTRIBUTE SIMD directive
+ !$omp distribute simd if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end distribute simd
+
+ !ERROR: IF clause is not allowed on directive DISTRIBUTE SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !ERROR: IF clause is not allowed on directive DISTRIBUTE SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !ERROR: At most one IF clause can appear on the DISTRIBUTE SIMD directive
+ !ERROR: SIMD is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=50
+ !$omp distribute simd if(.true.) if(simd: .false.)
+ do i = 1, 10
+ end do
+ !$omp end distribute simd
+ !$omp end teams
+
+ ! ----------------------------------------------------------------------------
+ ! DO SIMD
+ ! ----------------------------------------------------------------------------
+ !ERROR: IF clause is not allowed on directive DO SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !$omp do simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end do simd
+
+ !ERROR: IF clause is not allowed on directive DO SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !ERROR: SIMD is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=50
+ !$omp do simd if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end do simd
+
+ !ERROR: IF clause is not allowed on directive DO SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !ERROR: TARGET is not a constituent of the DO SIMD directive
+ !$omp do simd if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end do simd
+
+ !ERROR: IF clause is not allowed on directive DO SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !ERROR: IF clause is not allowed on directive DO SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !ERROR: At most one IF clause can appear on the DO SIMD directive
+ !ERROR: SIMD is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=50
+ !$omp do simd if(.true.) if(simd: .false.)
+ do i = 1, 10
+ end do
+ !$omp end do simd
+
+ ! ----------------------------------------------------------------------------
+ ! PARALLEL
+ ! ----------------------------------------------------------------------------
+ !$omp parallel if(.true.)
+ !$omp end parallel
+
+ !$omp parallel if(parallel: .true.)
+ !$omp end parallel
+
+ !ERROR: TARGET is not a constituent of the PARALLEL directive
+ !$omp parallel if(target: .true.)
+ !$omp end parallel
+
+ !ERROR: At most one IF clause can appear on the PARALLEL directive
+ !$omp parallel if(.true.) if(parallel: .false.)
+ !$omp end parallel
+
+ ! ----------------------------------------------------------------------------
+ ! PARALLEL DO
+ ! ----------------------------------------------------------------------------
+ !$omp parallel do if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end parallel do
+
+ !$omp parallel do if(parallel: .true.)
+ do i = 1, 10
+ end do
+ !$omp end parallel do
+
+ !ERROR: TARGET is not a constituent of the PARALLEL DO directive
+ !$omp parallel do if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end parallel do
+
+ !ERROR: At most one IF clause can appear on the PARALLEL DO directive
+ !$omp parallel do if(.true.) if(parallel: .false.)
+ do i = 1, 10
+ end do
+ !$omp end parallel do
+
+ ! ----------------------------------------------------------------------------
+ ! PARALLEL DO SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp parallel do simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end parallel do simd
+
+ !ERROR: SIMD is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=50
+ !$omp parallel do simd if(parallel: .true.) if(simd: .false.)
+ do i = 1, 10
+ end do
+ !$omp end parallel do simd
+
+ !ERROR: TARGET is not a constituent of the PARALLEL DO SIMD directive
+ !$omp parallel do simd if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end parallel do simd
+
+ ! ----------------------------------------------------------------------------
+ ! PARALLEL SECTIONS
+ ! ----------------------------------------------------------------------------
+ !$omp parallel sections if(.true.)
+ !$omp end parallel sections
+
+ !$omp parallel sections if(parallel: .true.)
+ !$omp end parallel sections
+
+ !ERROR: TARGET is not a constituent of the PARALLEL SECTIONS directive
+ !$omp parallel sections if(target: .true.)
+ !$omp end parallel sections
+
+ !ERROR: At most one IF clause can appear on the PARALLEL SECTIONS directive
+ !$omp parallel sections if(.true.) if(parallel: .false.)
+ !$omp end parallel sections
+
+ ! ----------------------------------------------------------------------------
+ ! PARALLEL WORKSHARE
+ ! ----------------------------------------------------------------------------
+ !$omp parallel workshare if(.true.)
+ !$omp end parallel workshare
+
+ !$omp parallel workshare if(parallel: .true.)
+ !$omp end parallel workshare
+
+ !ERROR: TARGET is not a constituent of the PARALLEL WORKSHARE directive
+ !$omp parallel workshare if(target: .true.)
+ !$omp end parallel workshare
+
+ !ERROR: At most one IF clause can appear on the PARALLEL WORKSHARE directive
+ !$omp parallel workshare if(.true.) if(parallel: .false.)
+ !$omp end parallel workshare
+
+ ! ----------------------------------------------------------------------------
+ ! SIMD
+ ! ----------------------------------------------------------------------------
+ !ERROR: IF clause is not allowed on directive SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !$omp simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end simd
+
+ !ERROR: IF clause is not allowed on directive SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !ERROR: SIMD is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=50
+ !$omp simd if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end simd
+
+ !ERROR: IF clause is not allowed on directive SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !ERROR: TARGET is not a constituent of the SIMD directive
+ !$omp simd if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end simd
+
+ !ERROR: IF clause is not allowed on directive SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !ERROR: IF clause is not allowed on directive SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !ERROR: At most one IF clause can appear on the SIMD directive
+ !ERROR: SIMD is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=50
+ !$omp simd if(.true.) if(simd: .false.)
+ do i = 1, 10
+ end do
+ !$omp end simd
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET
+ ! ----------------------------------------------------------------------------
+ !$omp target if(.true.)
+ !$omp end target
+
+ !$omp target if(target: .true.)
+ !$omp end target
+
+ !ERROR: PARALLEL is not a constituent of the TARGET directive
+ !$omp target if(parallel: .true.)
+ !$omp end target
+
+ !ERROR: At most one IF clause can appear on the TARGET directive
+ !$omp target if(.true.) if(target: .false.)
+ !$omp end target
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET DATA
+ ! ----------------------------------------------------------------------------
+ !$omp target data map(tofrom: i) if(.true.)
+ !$omp end target data
+
+ !$omp target data map(tofrom: i) if(target data: .true.)
+ !$omp end target data
+
+ !ERROR: TARGET is not a constituent of the TARGET DATA directive
+ !$omp target data map(tofrom: i) if(target: .true.)
+ !$omp end target data
+
+ !ERROR: At most one IF clause can appear on the TARGET DATA directive
+ !$omp target data map(tofrom: i) if(.true.) if(target data: .false.)
+ !$omp end target data
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET ENTER DATA
+ ! ----------------------------------------------------------------------------
+ !$omp target enter data map(to: i) if(.true.)
+
+ !$omp target enter data map(to: i) if(target enter data: .true.)
+
+ !ERROR: TARGET is not a constituent of the TARGET ENTER DATA directive
+ !$omp target enter data map(to: i) if(target: .true.)
+
+ !ERROR: At most one IF clause can appear on the TARGET ENTER DATA directive
+ !$omp target enter data map(to: i) if(.true.) if(target enter data: .false.)
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET EXIT DATA
+ ! ----------------------------------------------------------------------------
+ !$omp target exit data map(from: i) if(.true.)
+
+ !$omp target exit data map(from: i) if(target exit data: .true.)
+
+ !ERROR: TARGET is not a constituent of the TARGET EXIT DATA directive
+ !$omp target exit data map(from: i) if(target: .true.)
+
+ !ERROR: At most one IF clause can appear on the TARGET EXIT DATA directive
+ !$omp target exit data map(from: i) if(.true.) if(target exit data: .false.)
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET PARALLEL
+ ! ----------------------------------------------------------------------------
+ !$omp target parallel if(.true.)
+ !$omp end target parallel
+
+ !$omp target parallel if(target: .true.) if(parallel: .false.)
+ !$omp end target parallel
+
+ !ERROR: SIMD is not a constituent of the TARGET PARALLEL directive
+ !$omp target parallel if(simd: .true.)
+ !$omp end target parallel
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET PARALLEL DO
+ ! ----------------------------------------------------------------------------
+ !$omp target parallel do if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end target parallel do
+
+ !$omp target parallel do if(target: .true.) if(parallel: .false.)
+ do i = 1, 10
+ end do
+ !$omp end target parallel do
+
+ !ERROR: SIMD is not a constituent of the TARGET PARALLEL DO directive
+ !$omp target parallel do if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target parallel do
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET PARALLEL DO SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp target parallel do simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end target parallel do simd
+
+ !$omp target parallel do simd if(target: .true.) if(parallel: .false.) &
+ !ERROR: SIMD is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=50
+ !$omp& if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target parallel do simd
+
+ !ERROR: TEAMS is not a constituent of the TARGET PARALLEL DO SIMD directive
+ !$omp target parallel do simd if(teams: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target parallel do simd
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp target simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end target simd
+
+ !ERROR: SIMD is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=50
+ !$omp target simd if(target: .true.) if(simd: .false.)
+ do i = 1, 10
+ end do
+ !$omp end target simd
+
+ !ERROR: PARALLEL is not a constituent of the TARGET SIMD directive
+ !$omp target simd if(parallel: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target simd
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET TEAMS
+ ! ----------------------------------------------------------------------------
+ !$omp target teams if(.true.)
+ !$omp end target teams
+
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=52
+ !$omp target teams if(target: .true.) if(teams: .false.)
+ !$omp end target teams
+
+ !ERROR: PARALLEL is not a constituent of the TARGET TEAMS directive
+ !$omp target teams if(parallel: .true.)
+ !$omp end target teams
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET TEAMS DISTRIBUTE
+ ! ----------------------------------------------------------------------------
+ !$omp target teams distribute if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute
+
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=52
+ !$omp target teams distribute if(target: .true.) if(teams: .false.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute
+
+ !ERROR: PARALLEL is not a constituent of the TARGET TEAMS DISTRIBUTE directive
+ !$omp target teams distribute if(parallel: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET TEAMS DISTRIBUTE PARALLEL DO
+ ! ----------------------------------------------------------------------------
+ !$omp target teams distribute parallel do if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute parallel do
+
+ !$omp target teams distribute parallel do &
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=52
+ !$omp& if(target: .true.) if(teams: .false.) if(parallel: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute parallel do
+
+ !ERROR: SIMD is not a constituent of the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
+ !$omp target teams distribute parallel do if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute parallel do
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp target teams distribute parallel do simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute parallel do simd
+
+ !$omp target teams distribute parallel do simd &
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=52
+ !$omp& if(target: .true.) if(teams: .false.) if(parallel: .true.) &
+ !ERROR: SIMD is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=50
+ !$omp& if(simd: .false.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute parallel do simd
+
+ !ERROR: TASK is not a constituent of the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive
+ !$omp target teams distribute parallel do simd if(task: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute parallel do simd
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET TEAMS DISTRIBUTE SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp target teams distribute simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute simd
+
+ !$omp target teams distribute simd &
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=52
+ !ERROR: SIMD is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=50
+ !$omp& if(target: .true.) if(teams: .false.) if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute simd
+
+ !ERROR: PARALLEL is not a constituent of the TARGET TEAMS DISTRIBUTE SIMD directive
+ !$omp target teams distribute simd if(parallel: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute simd
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET UPDATE
+ ! ----------------------------------------------------------------------------
+ !$omp target update to(i) if(.true.)
+
+ !$omp target update to(i) if(target update: .true.)
+
+ !ERROR: TARGET is not a constituent of the TARGET UPDATE directive
+ !$omp target update to(i) if(target: .true.)
+
+ !ERROR: At most one IF clause can appear on the TARGET UPDATE directive
+ !$omp target update to(i) if(.true.) if(target update: .false.)
+
+ ! ----------------------------------------------------------------------------
+ ! TASK
+ ! ----------------------------------------------------------------------------
+ !$omp task if(.true.)
+ !$omp end task
+
+ !$omp task if(task: .true.)
+ !$omp end task
+
+ !ERROR: TARGET is not a constituent of the TASK directive
+ !$omp task if(target: .true.)
+ !$omp end task
+
+ !ERROR: At most one IF clause can appear on the TASK directive
+ !$omp task if(.true.) if(task: .false.)
+ !$omp end task
+
+ ! ----------------------------------------------------------------------------
+ ! TASKLOOP
+ ! ----------------------------------------------------------------------------
+ !$omp taskloop if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end taskloop
+
+ !$omp taskloop if(taskloop: .true.)
+ do i = 1, 10
+ end do
+ !$omp end taskloop
+
+ !ERROR: TARGET is not a constituent of the TASKLOOP directive
+ !$omp taskloop if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end taskloop
+
+ !ERROR: At most one IF clause can appear on the TASKLOOP directive
+ !$omp taskloop if(.true.) if(taskloop: .false.)
+ do i = 1, 10
+ end do
+ !$omp end taskloop
+
+ ! ----------------------------------------------------------------------------
+ ! TASKLOOP SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp taskloop simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end taskloop simd
+
+ !ERROR: SIMD is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=50
+ !$omp taskloop simd if(taskloop: .true.) if(simd: .false.)
+ do i = 1, 10
+ end do
+ !$omp end taskloop simd
+
+ !ERROR: TARGET is not a constituent of the TASKLOOP SIMD directive
+ !$omp taskloop simd if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end taskloop simd
+
+ ! ----------------------------------------------------------------------------
+ ! TEAMS
+ ! ----------------------------------------------------------------------------
+ !ERROR: IF clause is not allowed on directive TEAMS in OpenMP v4.5, try -fopenmp-version=52
+ !$omp teams if(.true.)
+ !$omp end teams
+
+ !ERROR: IF clause is not allowed on directive TEAMS in OpenMP v4.5, try -fopenmp-version=52
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=52
+ !$omp teams if(teams: .true.)
+ !$omp end teams
+
+ !ERROR: IF clause is not allowed on directive TEAMS in OpenMP v4.5, try -fopenmp-version=52
+ !ERROR: TARGET is not a constituent of the TEAMS directive
+ !$omp teams if(target: .true.)
+ !$omp end teams
+
+ !ERROR: IF clause is not allowed on directive TEAMS in OpenMP v4.5, try -fopenmp-version=52
+ !ERROR: IF clause is not allowed on directive TEAMS in OpenMP v4.5, try -fopenmp-version=52
+ !ERROR: At most one IF clause can appear on the TEAMS directive
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=52
+ !$omp teams if(.true.) if(teams: .false.)
+ !$omp end teams
+
+ ! ----------------------------------------------------------------------------
+ ! TEAMS DISTRIBUTE
+ ! ----------------------------------------------------------------------------
+ !$omp teams distribute if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute
+
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=52
+ !$omp teams distribute if(teams: .true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute
+
+ !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE directive
+ !$omp teams distribute if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute
+
+ !ERROR: At most one IF clause can appear on the TEAMS DISTRIBUTE directive
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=52
+ !$omp teams distribute if(.true.) if(teams: .true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute
+
+ ! ----------------------------------------------------------------------------
+ ! TEAMS DISTRIBUTE PARALLEL DO
+ ! ----------------------------------------------------------------------------
+ !$omp teams distribute parallel do if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute parallel do
+
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=52
+ !$omp teams distribute parallel do if(teams: .true.) if(parallel: .false.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute parallel do
+
+ !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE PARALLEL DO directive
+ !$omp teams distribute parallel do if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute parallel do
+
+ ! ----------------------------------------------------------------------------
+ ! TEAMS DISTRIBUTE PARALLEL DO SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp teams distribute parallel do simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute parallel do simd
+
+ !$omp teams distribute parallel do simd &
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=52
+ !ERROR: SIMD is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=50
+ !$omp& if(teams: .true.) if(parallel: .true.) if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute parallel do simd
+
+ !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE PARALLEL DO SIMD directive
+ !$omp teams distribute parallel do simd if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute parallel do simd
+
+ ! ----------------------------------------------------------------------------
+ ! TEAMS DISTRIBUTE SIMD
+ ! ----------------------------------------------------------------------------
+ !ERROR: IF clause is not allowed on directive TEAMS DISTRIBUTE SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !$omp teams distribute simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute simd
+
+ !ERROR: IF clause is not allowed on directive TEAMS DISTRIBUTE SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=52
+ !ERROR: IF clause is not allowed on directive TEAMS DISTRIBUTE SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !ERROR: SIMD is not allowed as 'directive-name-modifier' in OpenMP v4.5, try -fopenmp-version=50
+ !$omp teams distribute simd if(teams: .true.) if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute simd
+
+ !ERROR: IF clause is not allowed on directive TEAMS DISTRIBUTE SIMD in OpenMP v4.5, try -fopenmp-version=50
+ !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE SIMD directive
+ !$omp teams distribute simd if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute simd
+end program main
diff --git a/flang/test/Semantics/OpenMP/if-clause-50.f90 b/flang/test/Semantics/OpenMP/if-clause-50.f90
new file mode 100644
index 0000000..eb59776f
--- /dev/null
+++ b/flang/test/Semantics/OpenMP/if-clause-50.f90
@@ -0,0 +1,641 @@
+! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=50
+! Check OpenMP 'if' clause validity for all directives that can have it
+
+program main
+ integer :: i
+
+ ! ----------------------------------------------------------------------------
+ ! DISTRIBUTE PARALLEL DO
+ ! ----------------------------------------------------------------------------
+ !$omp teams
+ !$omp distribute parallel do if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end distribute parallel do
+
+ !$omp distribute parallel do if(parallel: .true.)
+ do i = 1, 10
+ end do
+ !$omp end distribute parallel do
+
+ !ERROR: TARGET is not a constituent of the DISTRIBUTE PARALLEL DO directive
+ !$omp distribute parallel do if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end distribute parallel do
+
+ !ERROR: At most one IF clause can appear on the DISTRIBUTE PARALLEL DO directive
+ !$omp distribute parallel do if(.true.) if(parallel: .false.)
+ do i = 1, 10
+ end do
+ !$omp end distribute parallel do
+ !$omp end teams
+
+ ! ----------------------------------------------------------------------------
+ ! DISTRIBUTE PARALLEL DO SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp teams
+ !$omp distribute parallel do simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end distribute parallel do simd
+
+ !$omp distribute parallel do simd if(parallel: .true.) if(simd: .false.)
+ do i = 1, 10
+ end do
+ !$omp end distribute parallel do simd
+
+ !ERROR: TARGET is not a constituent of the DISTRIBUTE PARALLEL DO SIMD directive
+ !$omp distribute parallel do simd if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end distribute parallel do simd
+ !$omp end teams
+
+ ! ----------------------------------------------------------------------------
+ ! DISTRIBUTE SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp teams
+ !$omp distribute simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end distribute simd
+
+ !$omp distribute simd if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end distribute simd
+
+ !ERROR: TARGET is not a constituent of the DISTRIBUTE SIMD directive
+ !$omp distribute simd if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end distribute simd
+
+ !ERROR: At most one IF clause can appear on the DISTRIBUTE SIMD directive
+ !$omp distribute simd if(.true.) if(simd: .false.)
+ do i = 1, 10
+ end do
+ !$omp end distribute simd
+ !$omp end teams
+
+ ! ----------------------------------------------------------------------------
+ ! DO SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp do simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end do simd
+
+ !$omp do simd if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end do simd
+
+ !ERROR: TARGET is not a constituent of the DO SIMD directive
+ !$omp do simd if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end do simd
+
+ !ERROR: At most one IF clause can appear on the DO SIMD directive
+ !$omp do simd if(.true.) if(simd: .false.)
+ do i = 1, 10
+ end do
+ !$omp end do simd
+
+ ! ----------------------------------------------------------------------------
+ ! PARALLEL
+ ! ----------------------------------------------------------------------------
+ !$omp parallel if(.true.)
+ !$omp end parallel
+
+ !$omp parallel if(parallel: .true.)
+ !$omp end parallel
+
+ !ERROR: TARGET is not a constituent of the PARALLEL directive
+ !$omp parallel if(target: .true.)
+ !$omp end parallel
+
+ !ERROR: At most one IF clause can appear on the PARALLEL directive
+ !$omp parallel if(.true.) if(parallel: .false.)
+ !$omp end parallel
+
+ ! ----------------------------------------------------------------------------
+ ! PARALLEL DO
+ ! ----------------------------------------------------------------------------
+ !$omp parallel do if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end parallel do
+
+ !$omp parallel do if(parallel: .true.)
+ do i = 1, 10
+ end do
+ !$omp end parallel do
+
+ !ERROR: TARGET is not a constituent of the PARALLEL DO directive
+ !$omp parallel do if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end parallel do
+
+ !ERROR: At most one IF clause can appear on the PARALLEL DO directive
+ !$omp parallel do if(.true.) if(parallel: .false.)
+ do i = 1, 10
+ end do
+ !$omp end parallel do
+
+ ! ----------------------------------------------------------------------------
+ ! PARALLEL DO SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp parallel do simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end parallel do simd
+
+ !$omp parallel do simd if(parallel: .true.) if(simd: .false.)
+ do i = 1, 10
+ end do
+ !$omp end parallel do simd
+
+ !ERROR: TARGET is not a constituent of the PARALLEL DO SIMD directive
+ !$omp parallel do simd if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end parallel do simd
+
+ ! ----------------------------------------------------------------------------
+ ! PARALLEL SECTIONS
+ ! ----------------------------------------------------------------------------
+ !$omp parallel sections if(.true.)
+ !$omp end parallel sections
+
+ !$omp parallel sections if(parallel: .true.)
+ !$omp end parallel sections
+
+ !ERROR: TARGET is not a constituent of the PARALLEL SECTIONS directive
+ !$omp parallel sections if(target: .true.)
+ !$omp end parallel sections
+
+ !ERROR: At most one IF clause can appear on the PARALLEL SECTIONS directive
+ !$omp parallel sections if(.true.) if(parallel: .false.)
+ !$omp end parallel sections
+
+ ! ----------------------------------------------------------------------------
+ ! PARALLEL WORKSHARE
+ ! ----------------------------------------------------------------------------
+ !$omp parallel workshare if(.true.)
+ !$omp end parallel workshare
+
+ !$omp parallel workshare if(parallel: .true.)
+ !$omp end parallel workshare
+
+ !ERROR: TARGET is not a constituent of the PARALLEL WORKSHARE directive
+ !$omp parallel workshare if(target: .true.)
+ !$omp end parallel workshare
+
+ !ERROR: At most one IF clause can appear on the PARALLEL WORKSHARE directive
+ !$omp parallel workshare if(.true.) if(parallel: .false.)
+ !$omp end parallel workshare
+
+ ! ----------------------------------------------------------------------------
+ ! SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end simd
+
+ !$omp simd if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end simd
+
+ !ERROR: TARGET is not a constituent of the SIMD directive
+ !$omp simd if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end simd
+
+ !ERROR: At most one IF clause can appear on the SIMD directive
+ !$omp simd if(.true.) if(simd: .false.)
+ do i = 1, 10
+ end do
+ !$omp end simd
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET
+ ! ----------------------------------------------------------------------------
+ !$omp target if(.true.)
+ !$omp end target
+
+ !$omp target if(target: .true.)
+ !$omp end target
+
+ !ERROR: PARALLEL is not a constituent of the TARGET directive
+ !$omp target if(parallel: .true.)
+ !$omp end target
+
+ !ERROR: At most one IF clause can appear on the TARGET directive
+ !$omp target if(.true.) if(target: .false.)
+ !$omp end target
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET DATA
+ ! ----------------------------------------------------------------------------
+ !$omp target data map(tofrom: i) if(.true.)
+ !$omp end target data
+
+ !$omp target data map(tofrom: i) if(target data: .true.)
+ !$omp end target data
+
+ !ERROR: TARGET is not a constituent of the TARGET DATA directive
+ !$omp target data map(tofrom: i) if(target: .true.)
+ !$omp end target data
+
+ !ERROR: At most one IF clause can appear on the TARGET DATA directive
+ !$omp target data map(tofrom: i) if(.true.) if(target data: .false.)
+ !$omp end target data
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET ENTER DATA
+ ! ----------------------------------------------------------------------------
+ !$omp target enter data map(to: i) if(.true.)
+
+ !$omp target enter data map(to: i) if(target enter data: .true.)
+
+ !ERROR: TARGET is not a constituent of the TARGET ENTER DATA directive
+ !$omp target enter data map(to: i) if(target: .true.)
+
+ !ERROR: At most one IF clause can appear on the TARGET ENTER DATA directive
+ !$omp target enter data map(to: i) if(.true.) if(target enter data: .false.)
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET EXIT DATA
+ ! ----------------------------------------------------------------------------
+ !$omp target exit data map(from: i) if(.true.)
+
+ !$omp target exit data map(from: i) if(target exit data: .true.)
+
+ !ERROR: TARGET is not a constituent of the TARGET EXIT DATA directive
+ !$omp target exit data map(from: i) if(target: .true.)
+
+ !ERROR: At most one IF clause can appear on the TARGET EXIT DATA directive
+ !$omp target exit data map(from: i) if(.true.) if(target exit data: .false.)
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET PARALLEL
+ ! ----------------------------------------------------------------------------
+ !$omp target parallel if(.true.)
+ !$omp end target parallel
+
+ !$omp target parallel if(target: .true.) if(parallel: .false.)
+ !$omp end target parallel
+
+ !ERROR: SIMD is not a constituent of the TARGET PARALLEL directive
+ !$omp target parallel if(simd: .true.)
+ !$omp end target parallel
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET PARALLEL DO
+ ! ----------------------------------------------------------------------------
+ !$omp target parallel do if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end target parallel do
+
+ !$omp target parallel do if(target: .true.) if(parallel: .false.)
+ do i = 1, 10
+ end do
+ !$omp end target parallel do
+
+ !ERROR: SIMD is not a constituent of the TARGET PARALLEL DO directive
+ !$omp target parallel do if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target parallel do
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET PARALLEL DO SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp target parallel do simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end target parallel do simd
+
+ !$omp target parallel do simd if(target: .true.) if(parallel: .false.) &
+ !$omp& if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target parallel do simd
+
+ !ERROR: TEAMS is not a constituent of the TARGET PARALLEL DO SIMD directive
+ !$omp target parallel do simd if(teams: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target parallel do simd
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp target simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end target simd
+
+ !$omp target simd if(target: .true.) if(simd: .false.)
+ do i = 1, 10
+ end do
+ !$omp end target simd
+
+ !ERROR: PARALLEL is not a constituent of the TARGET SIMD directive
+ !$omp target simd if(parallel: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target simd
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET TEAMS
+ ! ----------------------------------------------------------------------------
+ !$omp target teams if(.true.)
+ !$omp end target teams
+
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52
+ !$omp target teams if(target: .true.) if(teams: .false.)
+ !$omp end target teams
+
+ !ERROR: PARALLEL is not a constituent of the TARGET TEAMS directive
+ !$omp target teams if(parallel: .true.)
+ !$omp end target teams
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET TEAMS DISTRIBUTE
+ ! ----------------------------------------------------------------------------
+ !$omp target teams distribute if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute
+
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52
+ !$omp target teams distribute if(target: .true.) if(teams: .false.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute
+
+ !ERROR: PARALLEL is not a constituent of the TARGET TEAMS DISTRIBUTE directive
+ !$omp target teams distribute if(parallel: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET TEAMS DISTRIBUTE PARALLEL DO
+ ! ----------------------------------------------------------------------------
+ !$omp target teams distribute parallel do if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute parallel do
+
+ !$omp target teams distribute parallel do &
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52
+ !$omp& if(target: .true.) if(teams: .false.) if(parallel: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute parallel do
+
+ !ERROR: SIMD is not a constituent of the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
+ !$omp target teams distribute parallel do if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute parallel do
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp target teams distribute parallel do simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute parallel do simd
+
+ !$omp target teams distribute parallel do simd &
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52
+ !$omp& if(target: .true.) if(teams: .false.) if(parallel: .true.) &
+ !$omp& if(simd: .false.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute parallel do simd
+
+ !ERROR: TASK is not a constituent of the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive
+ !$omp target teams distribute parallel do simd if(task: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute parallel do simd
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET TEAMS DISTRIBUTE SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp target teams distribute simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute simd
+
+ !$omp target teams distribute simd &
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52
+ !$omp& if(target: .true.) if(teams: .false.) if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute simd
+
+ !ERROR: PARALLEL is not a constituent of the TARGET TEAMS DISTRIBUTE SIMD directive
+ !$omp target teams distribute simd if(parallel: .true.)
+ do i = 1, 10
+ end do
+ !$omp end target teams distribute simd
+
+ ! ----------------------------------------------------------------------------
+ ! TARGET UPDATE
+ ! ----------------------------------------------------------------------------
+ !$omp target update to(i) if(.true.)
+
+ !$omp target update to(i) if(target update: .true.)
+
+ !ERROR: TARGET is not a constituent of the TARGET UPDATE directive
+ !$omp target update to(i) if(target: .true.)
+
+ !ERROR: At most one IF clause can appear on the TARGET UPDATE directive
+ !$omp target update to(i) if(.true.) if(target update: .false.)
+
+ ! ----------------------------------------------------------------------------
+ ! TASK
+ ! ----------------------------------------------------------------------------
+ !$omp task if(.true.)
+ !$omp end task
+
+ !$omp task if(task: .true.)
+ !$omp end task
+
+ !ERROR: TARGET is not a constituent of the TASK directive
+ !$omp task if(target: .true.)
+ !$omp end task
+
+ !ERROR: At most one IF clause can appear on the TASK directive
+ !$omp task if(.true.) if(task: .false.)
+ !$omp end task
+
+ ! ----------------------------------------------------------------------------
+ ! TASKLOOP
+ ! ----------------------------------------------------------------------------
+ !$omp taskloop if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end taskloop
+
+ !$omp taskloop if(taskloop: .true.)
+ do i = 1, 10
+ end do
+ !$omp end taskloop
+
+ !ERROR: TARGET is not a constituent of the TASKLOOP directive
+ !$omp taskloop if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end taskloop
+
+ !ERROR: At most one IF clause can appear on the TASKLOOP directive
+ !$omp taskloop if(.true.) if(taskloop: .false.)
+ do i = 1, 10
+ end do
+ !$omp end taskloop
+
+ ! ----------------------------------------------------------------------------
+ ! TASKLOOP SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp taskloop simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end taskloop simd
+
+ !$omp taskloop simd if(taskloop: .true.) if(simd: .false.)
+ do i = 1, 10
+ end do
+ !$omp end taskloop simd
+
+ !ERROR: TARGET is not a constituent of the TASKLOOP SIMD directive
+ !$omp taskloop simd if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end taskloop simd
+
+ ! ----------------------------------------------------------------------------
+ ! TEAMS
+ ! ----------------------------------------------------------------------------
+ !ERROR: IF clause is not allowed on directive TEAMS in OpenMP v5.0, try -fopenmp-version=52
+ !$omp teams if(.true.)
+ !$omp end teams
+
+ !ERROR: IF clause is not allowed on directive TEAMS in OpenMP v5.0, try -fopenmp-version=52
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52
+ !$omp teams if(teams: .true.)
+ !$omp end teams
+
+ !ERROR: IF clause is not allowed on directive TEAMS in OpenMP v5.0, try -fopenmp-version=52
+ !ERROR: TARGET is not a constituent of the TEAMS directive
+ !$omp teams if(target: .true.)
+ !$omp end teams
+
+ !ERROR: IF clause is not allowed on directive TEAMS in OpenMP v5.0, try -fopenmp-version=52
+ !ERROR: IF clause is not allowed on directive TEAMS in OpenMP v5.0, try -fopenmp-version=52
+ !ERROR: At most one IF clause can appear on the TEAMS directive
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52
+ !$omp teams if(.true.) if(teams: .false.)
+ !$omp end teams
+
+ ! ----------------------------------------------------------------------------
+ ! TEAMS DISTRIBUTE
+ ! ----------------------------------------------------------------------------
+ !$omp teams distribute if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute
+
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52
+ !$omp teams distribute if(teams: .true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute
+
+ !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE directive
+ !$omp teams distribute if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute
+
+ !ERROR: At most one IF clause can appear on the TEAMS DISTRIBUTE directive
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52
+ !$omp teams distribute if(.true.) if(teams: .true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute
+
+ ! ----------------------------------------------------------------------------
+ ! TEAMS DISTRIBUTE PARALLEL DO
+ ! ----------------------------------------------------------------------------
+ !$omp teams distribute parallel do if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute parallel do
+
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52
+ !$omp teams distribute parallel do if(teams: .true.) if(parallel: .false.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute parallel do
+
+ !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE PARALLEL DO directive
+ !$omp teams distribute parallel do if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute parallel do
+
+ ! ----------------------------------------------------------------------------
+ ! TEAMS DISTRIBUTE PARALLEL DO SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp teams distribute parallel do simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute parallel do simd
+
+ !$omp teams distribute parallel do simd &
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52
+ !$omp& if(teams: .true.) if(parallel: .true.) if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute parallel do simd
+
+ !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE PARALLEL DO SIMD directive
+ !$omp teams distribute parallel do simd if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute parallel do simd
+
+ ! ----------------------------------------------------------------------------
+ ! TEAMS DISTRIBUTE SIMD
+ ! ----------------------------------------------------------------------------
+ !$omp teams distribute simd if(.true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute simd
+
+ !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52
+ !$omp teams distribute simd if(teams: .true.) if(simd: .true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute simd
+
+ !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE SIMD directive
+ !$omp teams distribute simd if(target: .true.)
+ do i = 1, 10
+ end do
+ !$omp end teams distribute simd
+end program main
diff --git a/flang/test/Semantics/OpenMP/symbol08.f90 b/flang/test/Semantics/OpenMP/symbol08.f90
index 545bccc..bf0f724 100644
--- a/flang/test/Semantics/OpenMP/symbol08.f90
+++ b/flang/test/Semantics/OpenMP/symbol08.f90
@@ -130,8 +130,7 @@ subroutine dotprod (b, c, n, block_size, num_teams, block_threads)
!REF: /dotprod/sum
sum = 0.0e0
!$omp target map(to:b,c) map(tofrom:sum)
-!$omp teams num_teams(num_teams) thread_limit(block_threads) reduction(+: sum&
-!$OMP&)
+!$omp teams num_teams(num_teams) thread_limit(block_threads) reduction(+: sum)
!$omp distribute
!DEF: /dotprod/OtherConstruct1/OtherConstruct1/OtherConstruct1/i0 (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!REF: /dotprod/n
diff --git a/flang/test/Semantics/assign02.f90 b/flang/test/Semantics/assign02.f90
index f998197..c447078 100644
--- a/flang/test/Semantics/assign02.f90
+++ b/flang/test/Semantics/assign02.f90
@@ -139,7 +139,7 @@ contains
real, target :: x
real, pointer :: p
p => f1()
- !ERROR: pointer 'p' is associated with the result of a reference to function 'f2' that is a not a pointer
+ !ERROR: pointer 'p' is associated with the result of a reference to function 'f2' that is not a pointer
p => f2()
contains
function f1()
diff --git a/flang/test/Semantics/bug1214.cuf b/flang/test/Semantics/bug1214.cuf
new file mode 100644
index 0000000..114fad1
--- /dev/null
+++ b/flang/test/Semantics/bug1214.cuf
@@ -0,0 +1,49 @@
+! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s
+module overrides
+ type realResult
+ real a
+ end type
+ interface operator(*)
+ procedure :: multHostDevice, multDeviceHost
+ end interface
+ interface assignment(=)
+ procedure :: assignHostResult, assignDeviceResult
+ end interface
+ contains
+ elemental function multHostDevice(x, y) result(result)
+ real, intent(in) :: x
+ real, intent(in), device :: y
+ type(realResult) result
+ result%a = x * y
+ end
+ elemental function multDeviceHost(x, y) result(result)
+ real, intent(in), device :: x
+ real, intent(in) :: y
+ type(realResult) result
+ result%a = x * y
+ end
+ elemental subroutine assignHostResult(lhs, rhs)
+ real, intent(out) :: lhs
+ type(realResult), intent(in) :: rhs
+ lhs = rhs%a
+ end
+ elemental subroutine assignDeviceResult(lhs, rhs)
+ real, intent(out), device :: lhs
+ type(realResult), intent(in) :: rhs
+ lhs = rhs%a
+ end
+end
+
+program p
+ use overrides
+ real, device :: da, db
+ real :: ha, hb
+!CHECK: CALL assigndeviceresult(db,multhostdevice(2._4,da))
+ db = 2. * da
+!CHECK: CALL assigndeviceresult(db,multdevicehost(da,2._4))
+ db = da * 2.
+!CHECK: CALL assignhostresult(ha,multhostdevice(2._4,da))
+ ha = 2. * da
+!CHECK: CALL assignhostresult(ha,multdevicehost(da,2._4))
+ ha = da * 2.
+end
diff --git a/flang/test/Semantics/c_f_pointer.f90 b/flang/test/Semantics/c_f_pointer.f90
index e2d0053..8a22175 100644
--- a/flang/test/Semantics/c_f_pointer.f90
+++ b/flang/test/Semantics/c_f_pointer.f90
@@ -54,4 +54,12 @@ program test
call c_f_pointer(scalarC, c2ptr)
!WARNING: FPTR= argument to C_F_POINTER() should not have the non-interoperable intrinsic type or kind CHARACTER(KIND=4,LEN=1_8) [-Winteroperability]
call c_f_pointer(scalarC, unicodePtr)
+
+ !ERROR: SHAPE= argument to C_F_POINTER() may not appear when FPTR= is scalar
+ !ERROR: LOWER= argument to C_F_POINTER() may not appear when FPTR= is scalar
+ call c_f_pointer(scalarC, scalarIntF, [1_8], [0_8])
+ !ERROR: LOWER= argument to C_F_POINTER() must be a rank-one array.
+ call c_f_pointer(scalarC, arrayIntF, shape=[1_8], lower=rankTwoArray)
+ !ERROR: SHAPE= argument to C_F_POINTER() must appear when FPTR= is an array
+ call c_f_pointer(scalarC, arrayIntF, lower=[0])
end program
diff --git a/flang/test/Semantics/cuf11.cuf b/flang/test/Semantics/cuf11.cuf
index 554ac25..1f5beb0 100644
--- a/flang/test/Semantics/cuf11.cuf
+++ b/flang/test/Semantics/cuf11.cuf
@@ -16,7 +16,7 @@ subroutine sub1()
real, device :: adev(10), bdev(10)
real :: ahost(10)
-!ERROR: More than one reference to a CUDA object on the right hand side of the assigment
+!ERROR: More than one reference to a CUDA object on the right hand side of the assignment
ahost = adev + bdev
ahost = adev + adev
diff --git a/flang/test/Semantics/resolve126.f90 b/flang/test/Semantics/resolve126.f90
new file mode 100644
index 0000000..6313f8c
--- /dev/null
+++ b/flang/test/Semantics/resolve126.f90
@@ -0,0 +1,7 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+!ERROR: Attributes 'INTRINSIC' and 'EXTERNAL' conflict with each other
+real, external, intrinsic :: exp
+!ERROR: Symbol 'sin' cannot have both EXTERNAL and INTRINSIC attributes
+external sin
+intrinsic sin
+end