[all-commits] [llvm/llvm-project] d89c1d: [flang][hlfir] refine hlfir.assign side effects (#...

jeanPerier via All-commits all-commits at lists.llvm.org
Wed Oct 23 03:33:36 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d89c1dbaf5f60c734f5168e8c778ba250d7d2d5e
      https://github.com/llvm/llvm-project/commit/d89c1dbaf5f60c734f5168e8c778ba250d7d2d5e
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2024-10-23 (Wed, 23 Oct 2024)

  Changed paths:
    M flang/include/flang/Optimizer/HLFIR/HLFIROps.td
    M flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
    A flang/test/HLFIR/assign-side-effects.fir

  Log Message:
  -----------
  [flang][hlfir] refine hlfir.assign side effects (#113319)

hlfir.assign currently has the `MemoryEffects<[MemWrite]` which makes it
look like it can write to anything. This is good for some cases where
the assign effect cannot be precisely described through the MLIR side
effect API (e.g., when the LHS is a descriptor and it is not possible to
get an OpOperand describing the data address, or when derived type are
involved and finalization could be called, or user defined assignment
for some components). For the most common case of hlfir.assign on
intrinsic types without whole allocatable LHS, this is pessimistic.

This patch implements a finer description of the side effects when
possible, and also adds the proper read/allocate/free effects when
relevant.

The ultimate goal is to suppress the generation of temporary for the LHS
address when dealing with an assignment to a vector subscripted LHS
where the vector subscript is an array constructor that does not refer
to the LHS (as in `x([a,b]) = y`).

Two more patches will follow to enable this.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list