This is an archive of the discontinued LLVM Phabricator instance.

[Flang][OpenMP][Parser] Resolve Declare Target Directive Symbols
ClosedPublic

Authored by agozillon on Jun 2 2023, 6:37 AM.

Details

Summary

Currently symbols are not resolved for declare target
after they've been modified by prior passes. This can
lead to missing or incorrect symbols in subsequent
compiler phases when declare target is used with
more complex types e.g. common block.

This patch should allow these symbols to be
resolved appropriately.

Diff Detail

Event Timeline

agozillon created this revision.Jun 2 2023, 6:37 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
agozillon requested review of this revision.Jun 2 2023, 6:37 AM
kiranchandramohan accepted this revision.Jun 2 2023, 8:09 AM

LG. Please add a -fdebug-dump-symbols test.

This revision is now accepted and ready to land.Jun 2 2023, 8:09 AM

Will add the test with the upstream commit, so that it's reflected in the changes here if that's alright, saves a secondary acceptance!

Please add the test along with this patch. You do not need a second acceptance.

agozillon updated this revision to Diff 527911.Jun 2 2023, 10:57 AM
  • Add Test and Small Tweak for RequiresMark to mark symbol declare target

Recent push added test and minor weak to mark symbols for output via dump symbols, similarly to firstprivate. I'll push this commit upstream when the recent change has cleared the patch buildbots.

flang/lib/Semantics/resolve-directives.cpp
526

Made a minor tweak here to allow marking of common block values as OmpDeclareTarget similar to OmpThreadprivate, the output can be seen in the test I've added. But now you can visually see that the common block is captured by a declare target when dumping symbols, although, it may be interesting to extend this in the future to add the clause it was captured with as well (but it's a little unnecessary for the moment).