This is an archive of the discontinued LLVM Phabricator instance.

[flang] Deallocate polymorphic and unlimited polymorphic intent(out) allocatable with runtime
ClosedPublic

Authored by clementval on Oct 4 2022, 4:36 AM.

Details

Summary

Polymorphic and unlimited polymorphic entities should be handled by runtime. This patch
update the condition in genDeallocate to force polymorphic and unlimited polymorphic entities
to be deallocated through a runtime call and not inlined.

Depends on D135143

Diff Detail

Event Timeline

clementval created this revision.Oct 4 2022, 4:36 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 4 2022, 4:36 AM
Herald added a subscriber: mehdi_amini. · View Herald Transcript
clementval requested review of this revision.Oct 4 2022, 4:36 AM
jeanPerier added inline comments.Oct 4 2022, 5:26 AM
flang/lib/Lower/Allocatable.cpp
514–516

Why doing this for unlimited polymorphic only ? Isn't the runtime needed with polymorphic in general to find the right finialization routine ?

clementval added inline comments.Oct 4 2022, 5:34 AM
flang/lib/Lower/Allocatable.cpp
514–516

Yes, polymorphic also need to go through the runtime. They are actually already covered by the first condition since they are "box" with derived type (test polymorphic_allocatable_intentout is checking for that). To be sure and make the code more readable I'll update the condition to a !box.isPolymorphic() so it covers both polymorphic and unlimited polymorphic

jeanPerier accepted this revision.Oct 4 2022, 8:12 AM
jeanPerier added inline comments.
flang/lib/Lower/Allocatable.cpp
514–516

Doh, makes sense. You can also keep isUnlimitedPolymorphic then, as you prefer.

This revision is now accepted and ready to land.Oct 4 2022, 8:12 AM

Add condition for polymoprhic to make things clearer.

clementval retitled this revision from [flang] Deallocate unlimited polymorphic intent(out) allocatable with runtime to [flang] Deallocate polymorphic and unlimited polymorphic intent(out) allocatable with runtime.Oct 4 2022, 12:34 PM
clementval edited the summary of this revision. (Show Details)
PeteSteinfeld requested changes to this revision.Oct 4 2022, 7:11 PM

Doesn't build.

flang/include/flang/Optimizer/Builder/BoxValue.h
254

It looks like you misspelled isPolymorphic.

This revision now requires changes to proceed.Oct 4 2022, 7:11 PM
PeteSteinfeld accepted this revision.Oct 5 2022, 6:49 AM

All builds and tests correctly and looks good.

This revision is now accepted and ready to land.Oct 5 2022, 6:49 AM