This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] Parse unordered attribute for elemental operations.
ClosedPublic

Authored by vzakhari on Jun 28 2023, 5:46 PM.

Details

Summary

By default, hlfir.elemental and hlfir.elemental_addr must process
the elements in order. The unordered attribute may be set,
if it is safe to process the elements out of order.
This patch just adds parsing support for the new attribute.

Diff Detail

Event Timeline

vzakhari created this revision.Jun 28 2023, 5:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 28 2023, 5:46 PM
jeanPerier accepted this revision.Jun 28 2023, 11:47 PM

Looks good

flang/include/flang/Optimizer/HLFIR/HLFIROps.td
1244

I agree that I do not see in which case we would currently generate a body with side effects. The only case I can think of is if we were to inline some "ordered" hlfir.elemental inside an hlfir.elemental_addr: the hlfir.elemental_addr should inherit the "ordered". But this is a risky optimization as there may be other Fortran rules to consider when doing this.
Having the attribute offers more flexibility, so I think it is fine to have it.

This revision is now accepted and ready to land.Jun 28 2023, 11:47 PM
tblah accepted this revision.Jun 29 2023, 2:34 AM

LGTM

vzakhari added inline comments.Jun 29 2023, 9:38 AM
flang/include/flang/Optimizer/HLFIR/HLFIROps.td
1244

Thank you for the review! I will remove the TODO comment then.