This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] Add assignment mask operations
ClosedPublic

Authored by jeanPerier on May 3 2023, 8:43 AM.

Details

Summary

Add hlfir.forall_mask, hlfir.where, and hlfir.elsewhere operations that
are operations that holds (optionally for hlfir.elsewhere) the
evaluation of a logical mask that controls the evaluation of nested
operations.

They allow representing Fortran forall control mask, as well as where
and eslewhere statements/constructs.

They use the OrderedAssignmentTreeOpInterface since they can all be used
inside Forall and their masks should be fully evaluated for all the
index-value set induced by parent Forall before any of the nested
operations in their body is evaluated.

I initially tried making them into a single operation with some attributes
to make a difference, but I felt this made the verifier/parser/printer and
usages messier/tricky compared to making three distinct operations that
represent the three Fortran feature in a vanilla way.

Depends on D149734

Diff Detail

Event Timeline

jeanPerier created this revision.May 3 2023, 8:43 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 3 2023, 8:43 AM
jeanPerier requested review of this revision.May 3 2023, 8:43 AM
tblah accepted this revision.May 3 2023, 9:52 AM

LGTM. This representation using regions to keep everything separate is really elegant.

This revision is now accepted and ready to land.May 3 2023, 9:52 AM
This revision was automatically updated to reflect the committed changes.