This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fix type mismatch in verification error
ClosedPublic

Authored by clementval on Jun 13 2022, 5:53 AM.

Details

Summary

FIR models Fortran intrinsic types with deliberate KIND values. Like
Fortran, COMPLEX and REAL have related KINDs in FIR. Lowering now
converts REAL types to floating point (MLIR) up front. This patch moves
the code to convert from FIR RealType to MLIR FloatType out of codegen
and into the builder, allowing FIR ComplexTypes to have their element
type returned as an MLIR FloatType.

We should consider whether to replace fir::ComplexType with
mlir::ComplexType at some point. I believe these types are presently
used to convey distinctins in the target ABIs in the Tilikum bridge
however.

This patch is part of the upstreaming effort from fir-dev branch.

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>

Diff Detail

Event Timeline

clementval created this revision.Jun 13 2022, 5:53 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 13 2022, 5:53 AM
clementval requested review of this revision.Jun 13 2022, 5:53 AM
PeteSteinfeld accepted this revision.Jun 13 2022, 6:58 AM

Aside from a couple of nits on the comments, all builds and tests correctly and looks good.

flang/include/flang/Optimizer/Dialect/FIRType.h
262

Should be "have a result that requires binding".

263

This also reads a little odd. Should probably be "with storage".

This revision is now accepted and ready to land.Jun 13 2022, 6:58 AM
This revision was automatically updated to reflect the committed changes.