A few OpenMP tests were retaining the FIR operands even after running the LLVM conversion pass. To fix these tests the legality checkes for OpenMP conversion are made stricter to include operands and results. The Flush, Single and Sections operations are added to conversions or legality checks. The RegionLessOpConversion is appropriately renamed to clarify that it works only for operations with Variable operands. The operands of the flush operation are changed to match those of Variable Operands. Fix for an OpenMP issue mentioned in https://github.com/llvm/llvm-project/issues/55210. Reviewed By: shraiysh, peixin, awarzynski Differential Revision: https://reviews.llvm.org/D127092
46 lines
1.5 KiB
Fortran
46 lines
1.5 KiB
Fortran
! This test checks lowering of OpenMP Flush Directive.
|
|
|
|
!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect"
|
|
!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | fir-opt --cfg-conversion | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="LLVMIRDialect,OMPDialect"
|
|
|
|
subroutine flush_standalone(a, b, c)
|
|
integer, intent(inout) :: a, b, c
|
|
|
|
!$omp flush(a,b,c)
|
|
!$omp flush
|
|
!OMPDialect: omp.flush(%{{.*}}, %{{.*}}, %{{.*}} :
|
|
!FIRDialect: !fir.ref<i32>, !fir.ref<i32>, !fir.ref<i32>)
|
|
!LLVMIRDialect: !llvm.ptr<i32>, !llvm.ptr<i32>, !llvm.ptr<i32>)
|
|
!OMPDialect: omp.flush
|
|
|
|
end subroutine flush_standalone
|
|
|
|
subroutine flush_parallel(a, b, c)
|
|
integer, intent(inout) :: a, b, c
|
|
|
|
!$omp parallel
|
|
!OMPDialect: omp.parallel {
|
|
|
|
!OMPDialect: omp.flush(%{{.*}}, %{{.*}}, %{{.*}} :
|
|
!FIRDialect: !fir.ref<i32>, !fir.ref<i32>, !fir.ref<i32>)
|
|
!LLVMIRDialect: !llvm.ptr<i32>, !llvm.ptr<i32>, !llvm.ptr<i32>)
|
|
!OMPDialect: omp.flush
|
|
!$omp flush(a,b,c)
|
|
!$omp flush
|
|
|
|
!FIRDialect: %{{.*}} = fir.load %{{.*}} : !fir.ref<i32>
|
|
!FIRDialect: %{{.*}} = fir.load %{{.*}} : !fir.ref<i32>
|
|
!FIRDialect: %{{.*}} = arith.addi %{{.*}}, %{{.*}} : i32
|
|
!FIRDialect: fir.store %{{.*}} to %{{.*}} : !fir.ref<i32>
|
|
|
|
!LLVMIRDialect: %{{.*}} = llvm.load %{{.*}} : !llvm.ptr<i32>
|
|
!LLVMIRDialect: %{{.*}} = llvm.load %{{.*}} : !llvm.ptr<i32>
|
|
!LLVMIRDialect: %{{.*}} = llvm.add %{{.*}}, %{{.*}} : i32
|
|
!LLVMIRDialect: llvm.store %{{.*}}, %{{.*}} : !llvm.ptr<i32>
|
|
c = a + b
|
|
|
|
!OMPDialect: omp.terminator
|
|
!$omp END parallel
|
|
|
|
end subroutine flush_parallel
|