[all-commits] [llvm/llvm-project] 09b772: [flang] Postpone hlfir.end_associate generation fo...

Slava Zakharin via All-commits all-commits at lists.llvm.org
Mon May 12 14:03:37 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 09b772e2efad804fdda02e2bd9ee44a2aaaddeeb
      https://github.com/llvm/llvm-project/commit/09b772e2efad804fdda02e2bd9ee44a2aaaddeeb
  Author: Slava Zakharin <szakharin at nvidia.com>
  Date:   2025-05-12 (Mon, 12 May 2025)

  Changed paths:
    M flang/lib/Lower/ConvertCall.cpp
    M flang/lib/Lower/OpenACC.cpp
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    A flang/test/Lower/HLFIR/call-postponed-associate.f90
    M flang/test/Lower/HLFIR/entry_return.f90
    M flang/test/Lower/HLFIR/proc-pointer-comp-nopass.f90
    M flang/test/Lower/OpenACC/acc-atomic-capture.f90
    M flang/test/Lower/OpenACC/acc-atomic-update.f90
    M flang/test/Lower/OpenMP/atomic-capture.f90
    M flang/test/Lower/OpenMP/atomic-update.f90

  Log Message:
  -----------
  [flang] Postpone hlfir.end_associate generation for calls. (#138786)

If we generate hlfir.end_associate at the end of the statement,
we get easier optimizable HLFIR, because there are no compiler
generated operations with side-effects in between the call
and the consumers. This allows more hlfir.eval_in_mem to reuse
the LHS instead of allocating temporary buffer.

I do not think the same can be done for hlfir.copy_out always, e.g.:
```
subroutine test2(x)
  interface
     function array_func2(x,y)
       real:: x(*), array_func2(10), y
     end function array_func2
  end interface
  real :: x(:)
  x = array_func2(x, 1.0)
end subroutine test2
```

If we postpone the copy-out until after the assignment, then
the result may be wrong.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list