This is an archive of the discontinued LLVM Phabricator instance.

[flang] Update createTempMutableBox to support polymorphic entities
ClosedPublic

Authored by clementval on Jan 13 2023, 1:06 AM.

Details

Summary

When creating temporary from a polymorphic entity, its dynamic type
information must be carried over to the temporary.
This patch updates createTempMutableBox to support passing a source_box
from which the information will be carried over.
This is tested on the spread intrinsic and follow-up patches will updates
other temporary creation where needed.

Diff Detail

Event Timeline

clementval created this revision.Jan 13 2023, 1:06 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJan 13 2023, 1:06 AM
Herald added a subscriber: mehdi_amini. · View Herald Transcript
clementval requested review of this revision.Jan 13 2023, 1:06 AM
jeanPerier accepted this revision.Jan 13 2023, 2:13 AM

LGTM functionally.

flang/lib/Optimizer/Builder/MutableBox.cpp
195

I was wondering about the name "sourceBox". It makes sense when you know you are working on the type, but I think a new reader might have trouble understanding its purpose at first (is it the source of a storage, of a value., of a type...). Would it makes sense to you to use "typeSourceBox" to insist that we only care about the dynamic type coming from this box ?

This revision is now accepted and ready to land.Jan 13 2023, 2:13 AM

sourceBox -> typeSourceBox + small comment

clementval marked an inline comment as done.Jan 13 2023, 4:39 AM
clementval added inline comments.
flang/lib/Optimizer/Builder/MutableBox.cpp
195

Yeah it makes sense to insist that we care about the dynamic type information here and nothing else in the box. I'll update it before merging.

PeteSteinfeld accepted this revision.Jan 13 2023, 7:44 AM

All builds and tests correctly and looks good.