[all-commits] [llvm/llvm-project] e73614: [fir] Add fir.array_amend operation definition

Valentin Clement (バレンタイン クレメン) via All-commits all-commits at lists.llvm.org
Thu Feb 3 06:04:52 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e7361469bbb64d80a70d23bb24d45402b4644e3e
      https://github.com/llvm/llvm-project/commit/e7361469bbb64d80a70d23bb24d45402b4644e3e
  Author: Valentin Clement <clementval at gmail.com>
  Date:   2022-02-03 (Thu, 03 Feb 2022)

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

  Log Message:
  -----------
  [fir] Add fir.array_amend operation definition

This patch adds the fir.array_amend operation. this op
is used later in upstreaming patches for the F95 compliance.

The `array_amend` operation marks an array value as having been changed via
a reference obtain by an `array_access`. It acts as a logical transaction
log that is used to merge the final result back with an `array_merge_store`
operation.

 ```mlir
  // fetch the value of one of the array value's elements
  %1 = fir.array_access %v, %i, %j : (!fir.array<?x?xT>, index, index) -> !fir.ref<T>
  // modify the element by storing data using %1 as a reference
  %2 = ... %1 ...
  // mark the array value
  %new_v = fir.array_amend %v, %2 : (!fir.array<?x?xT>, !fir.ref<T>) -> !fir.array<?x?xT>
```

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

Reviewed By: kiranchandramohan, schweitz

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

Co-authored-by: Eric Schweitz <eschweitz at nvidia.com>




More information about the All-commits mailing list