This is an archive of the discontinued LLVM Phabricator instance.

[flang] Preserve useResultSymbolShape_ option when folding array constructor shape
ClosedPublic

Authored by jeanPerier on Feb 21 2023, 11:57 AM.

Details

Summary

By default evaluate::GetShape(expr) may return a compiler generated expression
using symbols that are part of function interfaces if there are function
references in "expr".
It is not right to replace an inquiry of "expr" with such compiler
generated expression since the call context would be lost, along with
the meaning of the inquiry expression.
Inquiry folding uses GetContextFreeShape(expr) that sets-up
useResultSymbolShape_ in GetShapeHelper to prevent such bad rewrites. But this did not
work properly with array constructor: GetShapeHelper made a call to
GetShape, ignoring and losing the "useResultSymbolShape_" instruction.

Diff Detail

Event Timeline

jeanPerier created this revision.Feb 21 2023, 11:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 21 2023, 11:57 AM
Herald added a subscriber: jdoerfert. · View Herald Transcript
jeanPerier requested review of this revision.Feb 21 2023, 11:57 AM

Rebase to include unrelated flang test fix.

klausler accepted this revision.Feb 23 2023, 8:57 AM
This revision is now accepted and ready to land.Feb 23 2023, 8:57 AM