[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@gmail.com>
Loading
Please sign in to comment