Page MenuHomePhabricator

[fir] Add fir.array_amend operation definition

Authored by clementval on Oct 25 2021, 6:23 AM.



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

  // 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.

Co-authored-by: Eric Schweitz <>

Diff Detail

Event Timeline

clementval created this revision.Oct 25 2021, 6:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 25 2021, 6:23 AM
clementval requested review of this revision.Oct 25 2021, 6:23 AM
schweitz accepted this revision.Oct 26 2021, 12:09 PM
This revision is now accepted and ready to land.Oct 26 2021, 12:09 PM

Update operation description + rebase

clementval edited the summary of this revision. (Show Details)Jan 21 2022, 2:33 AM
kiranchandramohan accepted this revision.Feb 3 2022, 2:59 AM



Nit: obtained

clementval updated this revision to Diff 405578.Feb 3 2022, 4:29 AM

Rebase + typo

This revision was landed with ongoing or failed builds.Feb 3 2022, 6:04 AM
This revision was automatically updated to reflect the committed changes.