This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Fix transformed loop's var privacy
ClosedPublic

Authored by jdenny on May 24 2023, 10:58 AM.

Details

Summary

Without this patch, the following example crashes Clang:

#pragma omp target map(i)
#pragma omp tile sizes(2)
for (i = 0; i < N; ++i)
  ;

This patch fixes the crash by changing Sema::isOpenMPPrivateDecl not
to identify i as private just because it's the loop variable of a
tile construct.

While OpenMP TR11 and earlier do specify privacy for loop variables of
loops *generated* from a tile construct, I haven't found text
stating that the original loop variable must be private in the above
example, so this patch leaves it shared. Even so, it is a bit
unexpected that value of i after the loop is N - 1 instead of N.

Diff Detail

Event Timeline

jdenny created this revision.May 24 2023, 10:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 24 2023, 10:58 AM
jdenny requested review of this revision.May 24 2023, 10:58 AM
This revision is now accepted and ready to land.May 24 2023, 12:53 PM
This revision was landed with ongoing or failed builds.Jun 2 2023, 9:19 AM
This revision was automatically updated to reflect the committed changes.
jdenny added a comment.Jun 2 2023, 9:20 AM

Thanks for the review.