[all-commits] [llvm/llvm-project] a918df: [flang][hlfir] use adaptor in associate bufferization

Tom Eccles via All-commits all-commits at lists.llvm.org
Tue Jul 11 03:34:16 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a918df1716e28c4122452dc7dfe6b67412bbb900
      https://github.com/llvm/llvm-project/commit/a918df1716e28c4122452dc7dfe6b67412bbb900
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2023-07-11 (Tue, 11 Jul 2023)

  Changed paths:
    M flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp
    M flang/test/HLFIR/associate-codegen.fir

  Log Message:
  -----------
  [flang][hlfir] use adaptor in associate bufferization

The associate operation checks if it is the only use of the hlfir.expr,
and if so it can take ownership of the hlfir.expr instead of copying it
(move semantics).

If this check is done by accessing the associate operation's arguments
directly (not through the AssociateOpAdaptor), the expression uses will
contain some operations which have been deleted. These can include prior
copies of the same associate operation, if that operation was cloned
(e.g. to lower a hlfir.elemental into a fir.do_loop). Accessing the
bufferized expression instead of the old hlfir.expr through the adaptor
avoids this false positive.

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


  Commit: a3f9ce69eeb2af52b07307e476eb5895a59fb75b
      https://github.com/llvm/llvm-project/commit/a3f9ce69eeb2af52b07307e476eb5895a59fb75b
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2023-07-11 (Tue, 11 Jul 2023)

  Changed paths:
    M flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp
    M flang/test/HLFIR/associate-codegen.fir

  Log Message:
  -----------
  [flang][hlfir]: fix associate of expr with more than one use

Make a copy of the expression and associate that so that this is the
only use.

So far as I know, we don't currently generate code for an associate with
more than one use. This is here just in case.

Depends on D154715

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


Compare: https://github.com/llvm/llvm-project/compare/77b3f890ccad...a3f9ce69eeb2


More information about the All-commits mailing list