[Openmp-commits] [mlir] [openmp] [flang] [Flang][OpenMP] Remove use of non reference values from MapInfoOp (PR #72444)

via Openmp-commits openmp-commits at lists.llvm.org
Tue Nov 21 04:59:00 PST 2023


jeanPerier wrote:

 > Wouldn't it be cleaner to use the clone helper to create them rather than manually?

If you use side effect interface to check that you are not cloning anything with side effects, it is OK with me. I think your current patch is still cloning things it should not (like calls, but you should not have a "reject list", you should either use MLIR side effect interface or have an "op-in" list for things you know you want to clone because this is the common case you want to optimize: e.g: constant and shape.... Using the MLIR side effect interface is likely the cleanest).

Here is an example of something I think the patch may not be dealing with correctly (cloning a function call while the function may evaluate to different value):


```
module m
integer :: n

contains
pure integer function get_n()
  get_n = n
end function

subroutine omp_target_implicit_bounds()
  integer :: a(get_n(), 1024)
  n = n + 1
  !$omp target
    a(11, 22) = 33
  !$omp end target
end subroutine omp_target_implicit_bounds
end module
```


https://github.com/llvm/llvm-project/pull/72444


More information about the Openmp-commits mailing list