This is an archive of the discontinued LLVM Phabricator instance.

[flang][OpenMP] Fix the use-associated bug in threadprivate directive lowering
ClosedPublic

Authored by peixin on Oct 16 2022, 2:10 AM.

Details

Summary

The symbol may be used by use-association for multiple times such
as one in module specification part and one in module procedure.
Then in module procedure, the variable instantiation will be called
for multiple times. But we only need to threadprivatize it once and
use the threadprivatized value for the second time.

Fix #58379.

Diff Detail

Event Timeline

peixin created this revision.Oct 16 2022, 2:10 AM
peixin requested review of this revision.Oct 16 2022, 2:10 AM
peixin planned changes to this revision.Oct 16 2022, 6:46 AM

Think out one better idea to fix this. Doing it.

peixin updated this revision to Diff 468071.Oct 16 2022, 7:37 AM
peixin edited the summary of this revision. (Show Details)

LGTM. Thanks for the quick fix.

flang/lib/Lower/OpenMP.cpp
1778–1780
flang/test/Lower/OpenMP/threadprivate-use-association-2.f90
3
This revision is now accepted and ready to land.Oct 16 2022, 3:08 PM
peixin updated this revision to Diff 468166.Oct 17 2022, 4:44 AM

Address the comments.

This revision was landed with ongoing or failed builds.Oct 17 2022, 4:47 AM
This revision was automatically updated to reflect the committed changes.