[all-commits] [llvm/llvm-project] dc4d94: [fir] add fir.array_modify op

jeanPerier via All-commits all-commits at lists.llvm.org
Mon Oct 4 12:00:59 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dc4d94e620a9fea54b23293cc95c7f143f1e5bee
      https://github.com/llvm/llvm-project/commit/dc4d94e620a9fea54b23293cc95c7f143f1e5bee
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2021-10-04 (Mon, 04 Oct 2021)

  Changed paths:
    M flang/include/flang/Optimizer/Dialect/FIROps.td
    M flang/lib/Optimizer/Dialect/FIROps.cpp
    M flang/test/Fir/fir-ops.fir
    M flang/test/Fir/invalid.fir

  Log Message:
  -----------
  [fir] add fir.array_modify op

fir.array_update is only handling intrinsic assignments.
They are two big differences with user defined assignments:
1. The LHS and RHS types may not match, this does not play well
   with fir.array_update that relies on both the merge and the
   updated element to have the same type.
2. user defined assignment has a call semantics, with potential
   side effects. So if a fir.array_update can hide a call, it traits
   would need to be updated.

Instead of hiding more semantic in the fir.array_update, introduce
a new fir.array_modify op that allows de-correlating indicating that
an array value element is modified, and how it is modified.
This allow the ArrayValueCopy pass to still perform copy elision
while not having to implement the call itself, and could in general
be used for all kind of assignments (e.g. character assignment).

Update the alias analysis to not rely on the merge arguments (since
fir.array_modify has none).
Instead, analyze what is done with the element address.
This implies adding the ability to follow the users of fir.array_modify,
as well as being able to go through fir.store that may be generated to
store the RHS value in order to pass it to a user define routine.
This is done by adding a ReachCollector class to gather all array
accesses.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D110928

Co-authored-by: Valentin Clement <clementval at gmail.com>




More information about the All-commits mailing list