5 Commits

Author SHA1 Message Date
Slava Zakharin
a3d560342c [flang][hlfir] Codegen for polymorphic hlfir.elemental.
The polymorphic temporary array is created using the provided mold
and the shape of the hlfir.elemental. The array is allocated right away,
because it is going to be initialized element per element.

Depends on D157315

Reviewed By: clementval, tblah

Differential Revision: https://reviews.llvm.org/D157316
2023-08-08 09:58:48 -07:00
Slava Zakharin
daa8734233 [flang][hlfir] Support polymorphic hlfir.expr values.
This patch sets 'polymorphic' attribute of hlfir::ExprType when
the value is created from a polymorphic entity.
Memoization of such ExprType involves creating a mutable descriptor
on the stack, which is initialized (as a null box) and passed to
AllocatableApplyMold with the mold being the entity from which
the ExprType value is being created.

This patch fixes "creating polymorphic temporary" TODO and also
several cases of "'fir.convert' op invalid type conversion" error.

Reviewed By: tblah

Differential Revision: https://reviews.llvm.org/D155541
2023-07-18 09:00:26 -07:00
Valentin Clement
38c85a4196
[flang] Do not query type_desc for unlimited polymoprhic entities in move_alloc
In D144997, the dynamic type of polymorphic entities is reset to the declared
type when the FROM is deallocated. To do this, the declared type was passed as
a fir.type_desc op. For unlimited polymorphic entities, this should just be a
null pointer.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D145380
2023-03-06 17:57:02 +01:00
Valentin Clement
f88bc7d426
[flang] Handle dynamic type in move_alloc
Update move_alloc to carry over the dyanmic type of `from` to `to`
and reset the dynamic type of `from` to its declared type when it
is polymorphic.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D144997
2023-03-01 09:45:02 +01:00
David Truby
2ab1c6d375 [flang] Add lowering of move_alloc to IntrinsicCall
This patch relies on D141286 for the runtime implementation of
move_alloc.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D141616
2023-01-20 15:12:25 +00:00