This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Initial parsing/sema for the 'omp teams loop' construct
ClosedPublic

Authored by mikerice on Mar 15 2022, 9:25 AM.

Details

Summary

Adds basic parsing/sema/serialization support for the #pragma omp teams loop directive.

Diff Detail

Event Timeline

mikerice created this revision.Mar 15 2022, 9:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2022, 9:25 AM
mikerice requested review of this revision.Mar 15 2022, 9:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2022, 9:25 AM

Also, would be good to add test(s) to test/Analysis/cfg-openmp.cpp

clang/lib/Basic/OpenMPKinds.cpp
706

Why do you need OMPD_unknown region here?

clang/lib/Sema/SemaOpenMP.cpp
4279–4285

Copy/paste? The binding here is known aready, no?

10219–10239

Can we move this check to ActOnOpenMPLastprivate? To avoid copy/paste and double iteration on list items.

clang/test/OpenMP/teams_generic_loop_ast_print.cpp
10–11

Why need a dump here?

mikerice added inline comments.Mar 15 2022, 3:53 PM
clang/lib/Basic/OpenMPKinds.cpp
706

I added this for the same reason as loop, assuming it could be different based on binding. What do you think it should be instead?

clang/lib/Sema/SemaOpenMP.cpp
4279–4285

Since I didn't write codegen for this I don't really know what this should be. The codegen I've seen seems to produce different code depending on the binding in this case, so I left an unknown region to be replaced by the right code when someone does the codegen.

I'll do whatever you want here. What do you think it should be?

10219–10239

There is a timing problem with that. ActOnOpenMPLastprivate happens before ActOnOpenMPLoopInitialization so DSAStack->isLoopControlVariable() doesn't work there.

I can certainly factor that though.

clang/test/OpenMP/teams_generic_loop_ast_print.cpp
10–11

I guess it is not really needed. I'll remove it.

ABataev added inline comments.Mar 15 2022, 4:01 PM
clang/lib/Sema/SemaOpenMP.cpp
4279–4285

I thought the binding region here is teams, so only OMPD_teams should be enough, without extra OMPD_unknown.

mikerice updated this revision to Diff 415953.Mar 16 2022, 1:36 PM

Address review comments.

This revision is now accepted and ready to land.Mar 16 2022, 1:40 PM
This revision was landed with ongoing or failed builds.Mar 16 2022, 2:50 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2022, 2:51 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript