llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[Flang][OpenMP] Generate reduction operation for MAX intrinsic reduction

Open kavitha-natarajan opened this issue 3 years ago • 4 comments

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.

kavitha-natarajan avatar Mar 29 '23 18:03 kavitha-natarajan

@llvm/issue-subscribers-openmp

llvmbot avatar Mar 29 '23 18:03 llvmbot

@llvm/issue-subscribers-flang-ir

llvmbot avatar Mar 29 '23 18:03 llvmbot

@llvm/issue-subscribers-bug

llvmbot avatar Jun 06 '23 21:06 llvmbot

This is fixed with current flang main

tblah avatar Sep 02 '24 17:09 tblah