Files
clang-p2996/flang/test/Lower/OpenMP/location.f90
Akash Banerjee fbaf2c6cf7 [OpenMP][Flang] Add "IsolatedFromAbove" trait to omp.target
This patch adds the PFT lowering changes required for adding the IsolatedFromAbove trait to omp.target.

Key Changes:
	- Add IsolatedFromAbove trait to target op in MLIR.
	- Main reason for this change is to prevent CSE and other similar optimisations from crossing region boundaries for target operations. The link below has the discourse discussion surrounding this issue.
	- Move implicit operand capturing to the PFT lowering stage.
	- Implicit operands are first added as implicitly captured map_operands with their map_types set accordingly to indicate this. Later, all map_operands including implicit ones are added as block arguments.
	- Remove `implicit` attribute from the `MapInfoOp`. This information is already captured by the `map_type`.
	- The custom printer and parser for the map_types have been updated to show the `implicit` and `literal` map_types.
	- Update related tests.
	- This fixes #63555.
	- This fixes #70488.
2023-11-06 13:24:02 +00:00

69 lines
1.7 KiB
Fortran

! This test checks location of OpenMP constructs and clauses
!RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --mlir-print-debuginfo %s -o - | FileCheck %s
!CHECK-LABEL: sub_parallel
subroutine sub_parallel()
print *, x
!CHECK: omp.parallel {
!$omp parallel
print *, x
!CHECK: omp.terminator loc(#[[PAR_LOC:.*]])
!CHECK: } loc(#[[PAR_LOC]])
!$omp end parallel
print *, x
end
!CHECK-LABEL: sub_target
subroutine sub_target()
print *, x
!CHECK: omp.target {{.*}} {
!$omp target
print *, x
!CHECK: omp.terminator loc(#[[TAR_LOC:.*]])
!CHECK: } loc(#[[TAR_LOC]])
!$omp end target
print *, x
end
!CHECK-LABEL: sub_loop
subroutine sub_loop()
!CHECK: omp.wsloop {{.*}} {
!$omp do
do i=1,10
print *, i
!CHECK: omp.yield loc(#[[LOOP_LOC:.*]])
!CHECK: } loc(#[[LOOP_LOC]])
end do
!$omp end do
end
!CHECK-LABEL: sub_standalone
subroutine sub_standalone()
!CHECK: omp.barrier loc(#[[BAR_LOC:.*]])
!$omp barrier
!CHECK: omp.taskwait loc(#[[TW_LOC:.*]])
!$omp taskwait
!CHECK: omp.taskyield loc(#[[TY_LOC:.*]])
!$omp taskyield
end
subroutine sub_if(c)
logical(kind=4) :: c
!CHECK: %[[CVT:.*]] = fir.convert %{{.*}} : (!fir.logical<4>) -> i1 loc(#[[IF_LOC:.*]])
!CHECK: omp.task if(%[[CVT]])
!$omp task if(c)
print *, "Task"
!$omp end task
!CHECK: } loc(#[[TASK_LOC:.*]])
end subroutine
!CHECK: #[[PAR_LOC]] = loc("{{.*}}location.f90":9:9)
!CHECK: #[[TAR_LOC]] = loc("{{.*}}location.f90":21:9)
!CHECK: #[[LOOP_LOC]] = loc("{{.*}}location.f90":32:9)
!CHECK: #[[BAR_LOC]] = loc("{{.*}}location.f90":44:9)
!CHECK: #[[TW_LOC]] = loc("{{.*}}location.f90":46:9)
!CHECK: #[[TY_LOC]] = loc("{{.*}}location.f90":48:9)
!CHECK: #[[IF_LOC]] = loc("{{.*}}location.f90":55:14)
!CHECK: #[[TASK_LOC]] = loc("{{.*}}location.f90":55:9)