llvm-project
llvm-project copied to clipboard
[Flang][OpenMP] Generate reduction operation for MAX intrinsic reduction
Flang does not generate reduction operation for OpenMP MAX intrinsic reduction when the reduction is implemented in the following way:
!$omp parallel
!$omp do reduction(max:x)
do i=1, 100
if (y(i) .gt. x) x = y(i)
end do
!$omp end do
!$omp end parallel
Currently, Flang generates reduction operation for the below implementation only:
!$omp parallel
!$omp do reduction(max:x)
do i=1, 100
x = max(y(i), x)
end do
!$omp end do
!$omp end parallel
Refer test case flang/test/Lower/OpenMP/wsloop-reduction-max.f90 and update this testcase to test reduction operation generation for the above first case as well.
@llvm/issue-subscribers-openmp
@llvm/issue-subscribers-flang-ir
@llvm/issue-subscribers-bug
This is fixed with current flang main