Issue 171894
Summary [flang] Missed optimizations with conditional do concurrent
Labels flang
Assignees
Reporter foxtran
    Assuming one have two implementations of filling triangle in matrix:

```
subroutine trfill_docon(x, n)
  implicit none
  integer, intent(in) :: n
  real(8), intent(inout) :: x(n,n)
  integer :: i, j
  do concurrent (i = 1:n, j = 1:n, .not. j <= i)
    x(i,j) = x(j,i)
  end do
end subroutine trfill_docon

subroutine trfill_dodo(x, n)
  implicit none
  integer, intent(in) :: n
  real(8), intent(inout) :: x(n,n)
 integer :: i, j
  do i = 1, n
  do j = 1, n
    if (j <= i) continue
 x(i,j) = x(j,i)
  end do
  end do
end subroutine trfill_dodo
```

Resulting ASM for znver5: https://godbolt.org/z/sEM93f57b

The variant with `do concurrent` has much more branches in comparison with `do-do` example. I would expect the same asm for both examples. Also, asm in GCC is much shorter for `trfill_dodo` routine.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to