This is an archive of the discontinued LLVM Phabricator instance.

[flang] Relax fir.rebox verifier with characters
ClosedPublic

Authored by jeanPerier on Mar 15 2022, 8:53 AM.

Details

Summary

Allow fir.rebox input and output element type to differ for characters
if:

  • Any of the character type is dynamic. Fortran allows making pointer

assignments between deferred and constant lengths entities, making this
case useful (if the input length is dynamic and the output length constant,
it is a user requirement that the length matches at runtime. There is no
option to check this at runtime, but it could be added as an option to
fir.rebox codegen later if desired).

  • Or, there is a slice in the fir.rebox (the fir.rebox can implement a

substring view, hence the constant output and input lengths).

This is only a verifier constraint change, the fir.rebox codegen is not
impacted and already support those cases.

Add related FIR parsing, error, and codegen tests.

Diff Detail

Event Timeline

jeanPerier created this revision.Mar 15 2022, 8:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2022, 8:53 AM
jeanPerier requested review of this revision.Mar 15 2022, 8:53 AM

LGTM except for some potential build issue.

Remove leftover dbg tag from test (caught by buildbot).
Make logic more readable by using a named variable.

This revision is now accepted and ready to land.Mar 16 2022, 3:04 AM
This revision was automatically updated to reflect the committed changes.