This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] Simplify hlfir::convertToValue
ClosedPublic

Authored by jeanPerier on Jun 19 2023, 12:59 AM.

Details

Summary

Use hlfir::loadTrivialScalars to dereference pointer, allocatables, and
load numerical and logical scalars.

This has a small fallout on tests:

  • load is done on the HLFIR entity (#0 of hlfir.declare) and not the FIR one (#1). This makes no difference at the FIR level (#1 and #0 only differs to account for assumed and explicit shape lower bounds).
  • loadTrivialScalars get rids of allocatable fir.box for monomoprhic scalars (it is not needed). This exposed a bug in lowering of MERGE with a polymorphic and a monomorphic argument: when the monomorphic is not a fir.box, the polymorphic fir.class should not be reboxed but its address should be read.

Diff Detail

Event Timeline

jeanPerier created this revision.Jun 19 2023, 12:59 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 19 2023, 12:59 AM
jeanPerier requested review of this revision.Jun 19 2023, 12:59 AM
jeanPerier edited the summary of this revision. (Show Details)Jun 19 2023, 1:00 AM
tblah accepted this revision.Jun 19 2023, 2:46 AM

Looks good to me, thanks!

This revision is now accepted and ready to land.Jun 19 2023, 2:48 AM
This revision was automatically updated to reflect the committed changes.