This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] Propagate acc.declare from hlfir.declare to fir.declare.
ClosedPublic

Authored by vzakhari on Aug 9 2023, 4:17 PM.

Details

Summary

The declare enter operations are failing verification after HLFIR to FIR
conversion, because we drop acc.declare attribute when converting
hlfir.declare to fir.declare. This patch just propagates all attributes
during the conversion. This may need to be changed in future, if some
attributes are invalid for fir.declare or they need to be mapped
into other attributes.

The added LIT test is a copy of Lower/OpenACC/acc-declare.f90
with the updated checks. It tests HLFIR after lowering and FIR
after HLFIR-to-FIR conversion.

The Lower/OpenACC/acc-declare.f90 is being actively changed, so
it may be better to put the new RUN commands and the new checks
into the original file. For example, when you add more testing
for OpenACC declare in Lower/OpenACC/acc-declare.f90, you
add checks just for FIR-lowering path. I will be able to add
HLFIR checks later for those pieces. When you change something
for the existing OpenACC declare, you will have to update
the checks for all three pipelines. Alternatively, we can keep
it in a separate file, but this will complicate the migration
a little bit. Please let me know what you would prefer.

Diff Detail

Event Timeline

vzakhari created this revision.Aug 9 2023, 4:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2023, 4:17 PM
vzakhari requested review of this revision.Aug 9 2023, 4:17 PM
razvanlupusoru accepted this revision.Aug 10 2023, 10:01 AM

Looks great! I am OK with a separate duplicated test for now.

This revision is now accepted and ready to land.Aug 10 2023, 10:01 AM

Thanks Slava! I'm ok to add the run line in the existing file if it is simpler. We are mostly done with declare so it should not evolve that much anymore.

clementval accepted this revision.Aug 10 2023, 11:11 AM

Thank you for the reviews. I think I will leave it as a separate file. Combining the three runs together results in not very straightforward check lines.