This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fix output type when emboxing intrinsic type to unlimited polymorphic box
ClosedPublic

Authored by clementval on Feb 13 2023, 1:34 AM.

Details

Summary

When emboxing an intrinsic type to a polymorphic descriptor, directly set its
type to fir.class<none>.

fir.class<i32> is not a real type used anywhere in lowering so make it right directly
avoid unnecessary convert op to fir.class<none>. Also fir.class<i32> would not be
recognized as unlimited polymorphic.

Diff Detail

Event Timeline

clementval created this revision.Feb 13 2023, 1:34 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 13 2023, 1:34 AM
clementval requested review of this revision.Feb 13 2023, 1:34 AM
clementval edited the summary of this revision. (Show Details)Feb 13 2023, 1:42 AM
jeanPerier added inline comments.Feb 13 2023, 2:24 AM
flang/lib/Optimizer/Builder/FIRBuilder.cpp
515

I think the same could apply with characters that are not covered by isa_trivial. It's probably safer to reverse the logic: everything that is not None or RecordType should be turned into None.

clementval edited the summary of this revision. (Show Details)

Reverse condition to handle char as well

clementval marked an inline comment as done.Feb 13 2023, 3:11 AM
clementval added inline comments.
flang/lib/Optimizer/Builder/FIRBuilder.cpp
515

Makes sense. Updated.

PeteSteinfeld accepted this revision.Feb 13 2023, 3:52 AM

All builds and tests correctly and looks good.

This revision is now accepted and ready to land.Feb 13 2023, 3:52 AM
clementval marked an inline comment as done.Feb 13 2023, 5:20 AM

This needs a bit more work to not override some important part of the type fir.array<i32> -> none instead of fir.array<none>. I'm preparing a more complete patch to deal with all the cases.