This is an archive of the discontinued LLVM Phabricator instance.

[OPENMP] Codegen for 'omp critical' directive.
ClosedPublic

Authored by ABataev on Sep 4 2014, 8:27 PM.

Details

Summary

This patch adds codegen for constructs:
#pragma omp critical [name]
<body>

It generates global variable ".gomp_critical_user_[name].var" of type int32[8]. Then it generates library call "kmpc_critical(loc, gtid, .gomp_critical_user_[name].var)", code for <body> statement and final call "kmpc_end_critical(loc, gtid, .gomp_critical_user_[name].var)".

Diff Detail

Repository
rL LLVM

Event Timeline

ABataev updated this revision to Diff 13298.Sep 4 2014, 8:27 PM
ABataev retitled this revision from to [OPENMP] Codegen for 'omp critical' directive..
ABataev updated this object.
ABataev edited the test plan for this revision. (Show Details)
ABataev added a subscriber: Unknown Object (MLST).
hfinkel accepted this revision.Sep 22 2014, 12:38 AM
hfinkel edited edge metadata.

LGTM.

lib/CodeGen/CGOpenMPRuntime.cpp
231 ↗(On Diff #13298)

Instead of calling find here, when you call GetOrCreateValue below, return Elem.getValue() if it is non-null.

test/OpenMP/critical_codegen.cpp
6 ↗(On Diff #13298)

We don't need the inclusion guards here.

This revision is now accepted and ready to land.Sep 22 2014, 12:38 AM

Hal, Thanks!

lib/CodeGen/CGOpenMPRuntime.cpp
231 ↗(On Diff #13298)

Ok, done.

test/OpenMP/critical_codegen.cpp
6 ↗(On Diff #13298)

No, we need it, because of "-include-pch %t" in the third RUN command. Without inclusion guard there are errors because of duplicated symbols.

ABataev closed this revision.Sep 22 2014, 3:12 AM
ABataev updated this revision to Diff 13923.

Closed by commit rL218239 (authored by @ABataev).