History log of /llvm-project/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp (Results 1 – 25 of 40)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2
# 0def9a92 01-Aug-2024 Valentin Clement (バレンタイン クレメン) <clementval@gmail.com>

[flang] Add allocator_idx attribute on fir.embox and fircg.ext_embox (#101212)

#100690 introduces allocator registry with the ability to store
allocator index in the descriptor. This patch adds an

[flang] Add allocator_idx attribute on fir.embox and fircg.ext_embox (#101212)

#100690 introduces allocator registry with the ability to store
allocator index in the descriptor. This patch adds an attribute to
fir.embox and fircg.ext_embox to be able to set the allocator index
while populating the descriptor fields.

show more ...


Revision tags: llvmorg-19.1.0-rc1, llvmorg-20-init
# bf08d0e1 22-Jul-2024 jeanPerier <jperier@nvidia.com>

[flang] fix cg-rewrite DCE (#99653)

cg-rewrite runs regionDCE to get rid of the unused fir.shape/shift/slice
before codegen since those operations have no codegen.
I came across an issue where unr

[flang] fix cg-rewrite DCE (#99653)

cg-rewrite runs regionDCE to get rid of the unused fir.shape/shift/slice
before codegen since those operations have no codegen.
I came across an issue where unreachable code would cause the pass to
fail with `error: loc(...): null operand found`.

It turns out `mlir::RegionDCE` does not work properly in presence of
unreachable code because it delete operations in reachable code that are
unused in reachable code, but still used in unreachable code (like the
constant in the added test case). It seems `mlir::RegionDCE` is always
run after `mlir::eraseUnreachableBlock` outside of this pass.

A solution could be to run `mlir::eraseUnreachableBlock` here or to try
modifying `mlir::RegionDCE`. But the current behavior may be
intentional, and both of these calls are actually quite expensive. For
instance, RegionDCE will does liveness analysis, and removes unused
block arguments, which is way more than what is needed here. I am not
very found of having this rather heavy transformation inside this pass
(they should be run after or before if they matter in the overall
pipeline).

Do a naïve backward deletion of the trivially dead operations instead.
It is cheaper, and works with unreachable code.

show more ...


# db791b27 02-Jul-2024 Ramkumar Ramachandra <ramkumar.ramachandra@codasip.com>

mlir/LogicalResult: move into llvm (#97309)

This patch is part of a project to move the Presburger library into
LLVM.


Revision tags: llvmorg-18.1.8, llvmorg-18.1.7
# 7eaae4e6 05-Jun-2024 Tom Eccles <tom.eccles@arm.com>

[flang][CodeGen][NFC] Reduce PreCGRewrite pass boilerplate (#94329)

The pass constructor can be generated automatically by tablegen.

This pass is module-level and runs on all instances of target

[flang][CodeGen][NFC] Reduce PreCGRewrite pass boilerplate (#94329)

The pass constructor can be generated automatically by tablegen.

This pass is module-level and runs on all instances of target operations
inside of it and so does not need any modification to support
alternative top-level operations.

show more ...


Revision tags: llvmorg-18.1.6
# cd5ee271 16-May-2024 Abid Qadeer <haqadeer@amd.com>

[reland][flang] Initial debug info support for local variables (#92304)

This is same as #90905 with an added fix. The issue was that we
generated variable info even when user asked for line-tables-

[reland][flang] Initial debug info support for local variables (#92304)

This is same as #90905 with an added fix. The issue was that we
generated variable info even when user asked for line-tables-only. This
caused llvm dwarf generation code to fail an assertion as it expected an
empty variable list.

Fixed by not generating debug info for variables when user wants only
line table. I also updated a test check for this case.

show more ...


# 46835711 15-May-2024 Pete Steinfeld <47540744+psteinfeld@users.noreply.github.com>

Revert "[flang] Initial debug info support for local variables. (#909… (#92302)

…05)"

This reverts commit 61da6366d043792d7db280ce9edd2db62516e0e8.

Update #90905 was causing many tests to fail

Revert "[flang] Initial debug info support for local variables. (#909… (#92302)

…05)"

This reverts commit 61da6366d043792d7db280ce9edd2db62516e0e8.

Update #90905 was causing many tests to fail.

See comments in #90905.

show more ...


# 61da6366 15-May-2024 Abid Qadeer <haqadeer@amd.com>

[flang] Initial debug info support for local variables. (#90905)

We need the information in the `DeclareOp` to generate debug information
for variables. Currently, cg-rewrite removes the `DeclareO

[flang] Initial debug info support for local variables. (#90905)

We need the information in the `DeclareOp` to generate debug information
for variables. Currently, cg-rewrite removes the `DeclareOp`. As
`AddDebugInfo` runs after that, it cannot process the `DeclareOp`. My
initial plan was to make the `AddDebugInfo` pass run before the cg-rewrite
but that has few issues.

1. Initially I was thinking to use the memref op to carry the variable
attr. But as @tblah suggested in the #86939, it makes more sense to
carry that information on `DeclareOp`. It also makes it easy to handle
it in codegen and there is no special handling needed for arguments. For
this reason, we need to preserve the `DeclareOp` till the codegen.

2. Running earlier, we will miss the changes in passes that run between
cg-rewrite and codegen.

But not removing the DeclareOp in cg-rewrite has the issue that ShapeOp
remains and it causes errors during codegen. To solve this problem, I
convert DeclareOp to XDeclareOp in cg-rewrite instead of removing
it. This was mentioned as possible solution by @jeanPerier in
https://reviews.llvm.org/D136254

The conversion follows similar logic as used for other operators in that
file. The FortranAttr and CudaAttr are currently not converted but left
as TODO when the need arise.

Now `AddDebugInfo` pass can extracts information about local variables
from `XDeclareOp` and creates `DILocalVariableAttr`. These are attached
to `XDeclareOp` using `FusedLoc` approach. Codegen can use them to
create `DbgDeclareOp`. I have added tests that checks the debug
information in mlir from and also in llvm ir.

Currently we only handle very limited types. Rest are given a place
holder type. The previous placeholder type was basic type with
`DW_ATE_address` encoding. When variables are added, it started
causing assertions in the llvm debug info generation logic for some
types. It has been changed to an interger type to prevent these issues
until we handle those types properly.

show more ...


Revision tags: llvmorg-18.1.5
# 986f832c 01-May-2024 Slava Zakharin <szakharin@nvidia.com>

[flang] Added fir.dummy_scope operation to preserve dummy arguments association. (#90642)

The new operation is just an abstract attribute that is attached to
[hl]fir.declare operations of dummy arg

[flang] Added fir.dummy_scope operation to preserve dummy arguments association. (#90642)

The new operation is just an abstract attribute that is attached to
[hl]fir.declare operations of dummy arguments of a subroutine.
Dummy arguments of the same subroutine refer to the same
fir.dummy_scope, so they can be recognized as such during FIR AliasAnalysis.
Note that the fir.dummy_scope must be specific to the runtime
instantiation of a subroutine, so any MLIR inlining/cloning should duplicate and
unique it vs using the same fir.dummy_scope for different runtime instantiations.
This is why I made it an operation rather than an attribute.
The new operation uses a write effect on DebuggingResource, same as
[hl]fir.declare, to avoid optimizing it away.

show more ...


# fac349a1 28-Apr-2024 Christian Sigg <chsigg@users.noreply.github.com>

Reapply "[mlir] Mark `isa/dyn_cast/cast/...` member functions depreca… (#90406)

…ted. (#89998)" (#90250)

This partially reverts commit 7aedd7dc754c74a49fe84ed2640e269c25414087.

This change rem

Reapply "[mlir] Mark `isa/dyn_cast/cast/...` member functions depreca… (#90406)

…ted. (#89998)" (#90250)

This partially reverts commit 7aedd7dc754c74a49fe84ed2640e269c25414087.

This change removes calls to the deprecated member functions. It does
not mark the functions deprecated yet and does not disable the
deprecation warning in TypeSwitch. This seems to cause problems with
MSVC.

show more ...


# 7aedd7dc 26-Apr-2024 dyung <douglas.yung@sony.com>

Revert "[mlir] Mark `isa/dyn_cast/cast/...` member functions deprecated. (#89998)" (#90250)

This reverts commit 950b7ce0b88318f9099e9a7c9817d224ebdc6337.

This change is causing build failures on

Revert "[mlir] Mark `isa/dyn_cast/cast/...` member functions deprecated. (#89998)" (#90250)

This reverts commit 950b7ce0b88318f9099e9a7c9817d224ebdc6337.

This change is causing build failures on a bot
https://lab.llvm.org/buildbot/#/builders/216/builds/38157

show more ...


# 950b7ce0 26-Apr-2024 Christian Sigg <chsigg@users.noreply.github.com>

[mlir] Mark `isa/dyn_cast/cast/...` member functions deprecated. (#89998)

See https://mlir.llvm.org/deprecation and
https://discourse.llvm.org/t/preferred-casting-style-going-forward.


Revision tags: llvmorg-18.1.4, llvmorg-18.1.3
# 1f63a56c 20-Mar-2024 Tom Eccles <tom.eccles@arm.com>

[flang][CodeGen] Run PreCGRewrite on omp reduction declare ops (#84954)

OpenMP reduction declare operations can contain FIR code which needs to
be lowered to LLVM. With array reductions, these regi

[flang][CodeGen] Run PreCGRewrite on omp reduction declare ops (#84954)

OpenMP reduction declare operations can contain FIR code which needs to
be lowered to LLVM. With array reductions, these regions can contain
more complicated operations which need PreCGRewriting. A similar extra
case was already needed for fir::GlobalOp.

OpenMP array reductions 3/6
Previous PR: https://github.com/llvm/llvm-project/pull/84953
Next PR: https://github.com/llvm/llvm-project/pull/84955

show more ...


Revision tags: llvmorg-18.1.2
# 22eb8000 14-Mar-2024 Valentin Clement (バレンタイン クレメン) <clementval@gmail.com>

[flang][NFC] Expose patterns from PreCGRewrite pass (#85156)

Expose patterns so they can be reused in other passes.


Revision tags: llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4
# b07ef9e7 09-Mar-2023 Renaud-K <rkauffmann@nvidia.com>

Break circular dependency between FIR dialect and utilities


Revision tags: llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2
# 2adcf1b2 03-Feb-2023 Jean Perier <jperier@nvidia.com>

[flang] use runRegionDCE instead of a custom DCE in cg-rewrite

The custom DCE in cg-rewrite is meant to get rid of fir.shape, fir.shift,
fir.shape_shift and fir.slice ops as well as their unused ope

[flang] use runRegionDCE instead of a custom DCE in cg-rewrite

The custom DCE in cg-rewrite is meant to get rid of fir.shape, fir.shift,
fir.shape_shift and fir.slice ops as well as their unused operands
before codegen (that does not lower those abstract operation to LLVM).

However, it turned out to be flowed in case some fir.shape operands were
unused outside of fir.shape and appeared several times as operands:
they were erased at the first appearance, causing the further attemp
to erase it to segfault (since the op IR storage was deallocated).

Instead of trying to fixing the custom DCE code, use mlir::runRegionDCE.

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

show more ...


Revision tags: llvmorg-16.0.0-rc1, llvmorg-17-init
# 9f1bb307 12-Jan-2023 Valentin Clement <clementval@gmail.com>

[flang] Carry the whole polymorphic box in PolymorphicValue

Until now, only the address of the type descriptor was hold in
a PolymorphicValue. In some cases, the element size and the
type code are a

[flang] Carry the whole polymorphic box in PolymorphicValue

Until now, only the address of the type descriptor was hold in
a PolymorphicValue. In some cases, the element size and the
type code are also needed when creating new polymorphic
descriptors from an element of a polymorphic entity.

This patch updates PolymorphicValue to carry the source
descriptor from which the element is extracted. The source
descriptor is then used when emboxing the element to a new
polymorphic descriptor.

This simplify the code done in D141274 and will be used
when creating polymorphic temporary as well.

Reviewed By: jeanPerier, PeteSteinfeld

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

show more ...


Revision tags: llvmorg-15.0.7
# 9a417395 03-Dec-2022 Kazu Hirata <kazu@google.com>

[flang] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of m

[flang] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

show more ...


Revision tags: llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4
# 2e978986 26-Oct-2022 Valentin Clement <clementval@gmail.com>

[flang] Use tdesc on fir.embox in code generation

For polymoprhic entities, the type descriptor is dynamic. The tdesc
operand on fir.embox is meant to propagate the dynamic type when
embox a polymor

[flang] Use tdesc on fir.embox in code generation

For polymoprhic entities, the type descriptor is dynamic. The tdesc
operand on fir.embox is meant to propagate the dynamic type when
embox a polymorphic entity.
This patch makes use of this operand in code generation and update
the created descriptor accordingly.

Reviewed By: jeanPerier

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

show more ...


# c852174a 20-Oct-2022 Jean Perier <jperier@nvidia.com>

[flang] add fir.declare codegen support

For now, nothing is done about debug info and the fir.declare is simply
replaced by the memref argument. This is done in the PreCGRewrite in
order to avoid re

[flang] add fir.declare codegen support

For now, nothing is done about debug info and the fir.declare is simply
replaced by the memref argument. This is done in the PreCGRewrite in
order to avoid requiring adding support for fir.shape codegen, which
would still be useless and undesired at that point.

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

show more ...


# 6e85b880 19-Oct-2022 Valentin Clement <clementval@gmail.com>

[flang] Add fir.dispatch code generation

fir.dispatch code generation uses the binding table stored in the
type descriptor. There is no runtime call involved. The binding table
is always build from

[flang] Add fir.dispatch code generation

fir.dispatch code generation uses the binding table stored in the
type descriptor. There is no runtime call involved. The binding table
is always build from the parent type so the index of a specific binding
is the same in the parent derived-type or in the extended type.

Follow-up patches will deal cases not present here such as allocatable
polymorphic entities or pointers.

Reviewed By: jeanPerier, PeteSteinfeld

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

show more ...


Revision tags: llvmorg-15.0.3, working, llvmorg-15.0.2
# 9d99b482 04-Oct-2022 Valentin Clement <clementval@gmail.com>

[flang] Lower polymorphic entities types in dummy argument and function result

This patch updates lowering to produce the correct fir.class types for
various polymorphic and unlimited polymoprhic en

[flang] Lower polymorphic entities types in dummy argument and function result

This patch updates lowering to produce the correct fir.class types for
various polymorphic and unlimited polymoprhic entities cases. This is only the
lowering. Some TODOs have been added to the CodeGen part to avoid errors since
this part still need to be updated as well.
The fir.class<*> representation for unlimited polymorphic entities mentioned in
the document has been updated to fir.class<none> to avoid useless work in pretty
parse/printer.

This patch is part of the implementation of the poltymorphic
entities.
https://github.com/llvm/llvm-project/blob/main/flang/docs/PolymorphicEntities.md

Depends on D134957

Reviewed By: jeanPerier

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

show more ...


# 6c8d8d10 29-Sep-2022 Jakub Kuderski <kubak@google.com>

[flang][mlir][arith] Fix flang build after dialect renaming

Tested with `ninja check-flang`


Revision tags: llvmorg-15.0.1, llvmorg-15.0.0
# 67d0d7ac 31-Aug-2022 Michele Scuttari <michele.scuttari@outlook.com>

[MLIR] Update pass declarations to new autogenerated files

The patch introduces the required changes to update the pass declarations and definitions to use the new autogenerated files and allow drop

[MLIR] Update pass declarations to new autogenerated files

The patch introduces the required changes to update the pass declarations and definitions to use the new autogenerated files and allow dropping the old infrastructure.

Reviewed By: mehdi_amini, rriddle

Differential Review: https://reviews.llvm.org/D132838

show more ...


# 039b969b 30-Aug-2022 Michele Scuttari <michele.scuttari@outlook.com>

Revert "[MLIR] Update pass declarations to new autogenerated files"

This reverts commit 2be8af8f0e0780901213b6fd3013a5268ddc3359.


# 2be8af8f 30-Aug-2022 Michele Scuttari <michele.scuttari@outlook.com>

[MLIR] Update pass declarations to new autogenerated files

The patch introduces the required changes to update the pass declarations and definitions to use the new autogenerated files and allow drop

[MLIR] Update pass declarations to new autogenerated files

The patch introduces the required changes to update the pass declarations and definitions to use the new autogenerated files and allow dropping the old infrastructure.

Reviewed By: mehdi_amini, rriddle

Differential Review: https://reviews.llvm.org/D132838

show more ...


12