This is an archive of the discontinued LLVM Phabricator instance.

[fir] add fir.array_modify op
ClosedPublic

Authored by clementval on Oct 1 2021, 5:57 AM.

Details

Summary

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.

Co-authored-by: Jean Perier <jperier@nvidia.com>

Diff Detail

Event Timeline

clementval created this revision.Oct 1 2021, 5:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 1 2021, 5:57 AM
clementval requested review of this revision.Oct 1 2021, 5:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 1 2021, 5:57 AM
schweitz accepted this revision.Oct 4 2021, 7:50 AM
This revision is now accepted and ready to land.Oct 4 2021, 7:50 AM
This revision was automatically updated to reflect the committed changes.