[all-commits] [llvm/llvm-project] 5c9250: [flang][hlfir] add hlfir.shape_of
Tom Eccles via All-commits
all-commits at lists.llvm.org
Mon Apr 17 06:28:04 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 5c925079927766adf72116b508d061c4a5803b56
https://github.com/llvm/llvm-project/commit/5c925079927766adf72116b508d061c4a5803b56
Author: Tom Eccles <tom.eccles at arm.com>
Date: 2023-04-17 (Mon, 17 Apr 2023)
Changed paths:
M flang/include/flang/Optimizer/HLFIR/HLFIRDialect.h
M flang/include/flang/Optimizer/HLFIR/HLFIROps.td
M flang/lib/Optimizer/HLFIR/IR/HLFIRDialect.cpp
M flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
M flang/test/HLFIR/invalid.fir
A flang/test/HLFIR/shapeof.fir
Log Message:
-----------
[flang][hlfir] add hlfir.shape_of
This is an operation which returns the fir.shape for a hlfir.expr.
A hlfir.expr can be defined by:
- A transformational intrinsic (e.g. hlfir.matmul)
- hlfir.as_expr
- hlfir.elemental
hlfir.elemental is easy because there is a compulsory shape operand.
hlfir.as_expr is defined as operating on a variable (defined using a
hlfir.declare). hlfir.declare has an optional shape argument. The
transformational intrinsics do not have an associated shape.
If all extents are known at compile time, the extents for the shape can
be fetched from the hlfir.expr's type. For example, the result of a
hlfir.matmul with arguments who's extents are known at compile time will
have constant extents which can be queried from the type. In this case
the hlfir.shape_of will be canonicalised to a fir.shape operation using
those extents.
If not all extents are known at compile time, shapes have to be read
from boxes after bufferization. In the case of the transformational
intrinsics, the shape read from the result box can be queried from the
hlfir.declare operation for the buffer allocated to that hlfir.expr (via
the hlfir.as_expr).
Differential Revision: https://reviews.llvm.org/D146830
Commit: 80e45a7947fa17a14db575a71aa178747de19b20
https://github.com/llvm/llvm-project/commit/80e45a7947fa17a14db575a71aa178747de19b20
Author: Tom Eccles <tom.eccles at arm.com>
Date: 2023-04-17 (Mon, 17 Apr 2023)
Changed paths:
M flang/include/flang/Optimizer/HLFIR/HLFIROps.td
M flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
A flang/test/HLFIR/getextent.fir
M flang/test/HLFIR/invalid.fir
Log Message:
-----------
[flang][hlfir] add hlfir.get_extent
This operation fetches an extent value from a fir.shape. The operation
could just as easily live in the fir namespace, but is only needed for
hlfir lowering so I put it here.
This operation is required to allow one to defer getting the extents of a shape
generated by hlfir.get_shape until after that shape has been resolved
(after bufferization of the hlfir.expr).
This operation will be lowered to FIR as an arith.constant created using
the definition of the fir.shape argument.
Depends on: D146830
Differential Revision: https://reviews.llvm.org/D148220
Commit: 08b09d79b129d98c79fd9827e80b147582f2f900
https://github.com/llvm/llvm-project/commit/08b09d79b129d98c79fd9827e80b147582f2f900
Author: Tom Eccles <tom.eccles at arm.com>
Date: 2023-04-17 (Mon, 17 Apr 2023)
Changed paths:
M flang/lib/Optimizer/Builder/HLFIRTools.cpp
Log Message:
-----------
[flang][hlfir] get shape from HLFIR expr using hlfir.shape_of
Depends On: D146830
Differential Revision: https://reviews.llvm.org/D146831
Commit: 5ab5cdc1e00e90865fb9907fe8d3a1e0fe3972c8
https://github.com/llvm/llvm-project/commit/5ab5cdc1e00e90865fb9907fe8d3a1e0fe3972c8
Author: Tom Eccles <tom.eccles at arm.com>
Date: 2023-04-17 (Mon, 17 Apr 2023)
Changed paths:
M flang/lib/Optimizer/Builder/HLFIRTools.cpp
A flang/test/HLFIR/extents-of-shape-of.f90
Log Message:
-----------
[flang][hlfir] get extents from hlfir.shape_of
If the extents were known, this should have been canonicalised into a
fir.shape operation. Therefore, the extents at this point are not known at
compile time. Use hlfir.get_extents to delay resolving the real extent
until after the expression is bufferized.
Depends On: D146831
Differential Revision: https://reviews.llvm.org/D146832
Commit: 683a6e1c9e5396f64086c07bec334a38acd0ec7a
https://github.com/llvm/llvm-project/commit/683a6e1c9e5396f64086c07bec334a38acd0ec7a
Author: Tom Eccles <tom.eccles at arm.com>
Date: 2023-04-17 (Mon, 17 Apr 2023)
Changed paths:
M flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp
A flang/test/HLFIR/shapeof-lowering.fir
Log Message:
-----------
[flang][hlfir] lower hlfir.shape_of
If possible the shape is gotten from the bufferization of the expr
argument.
The simple cases should already have been resolved during lowering. This
is mostly intended for cases where shape information is added in between
lowering and the end of bufferization (for example transformational
intrinsics with assumed shape arguments).
Depends on: D146832
Differential Revision: https://reviews.llvm.org/D146833
Commit: c2c49f464435fa6176c91898a94d8cadbdf93dfc
https://github.com/llvm/llvm-project/commit/c2c49f464435fa6176c91898a94d8cadbdf93dfc
Author: Tom Eccles <tom.eccles at arm.com>
Date: 2023-04-17 (Mon, 17 Apr 2023)
Changed paths:
M flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp
M flang/test/HLFIR/extents-of-shape-of.f90
Log Message:
-----------
[flang][hlfir] lower hlfir.get_extent to FIR
By the ConvertToFIR pass, the hlfir.get_shape operation will have been
lowered into a fir.shape operation (during the HFLIR bufferization pass)
and so, lowering get_extent is as simple as fetching the extent from the
shape operation.
Depends on: D146833
Differential Revision: https://reviews.llvm.org/D148222
Compare: https://github.com/llvm/llvm-project/compare/5b22df998400...c2c49f464435
More information about the All-commits
mailing list