This is an archive of the discontinued LLVM Phabricator instance.

[OPENMP] A helper for marking intstructions with llvm.mem.parallel_loop_access
ClosedPublic

Authored by amusman on May 7 2014, 6:12 AM.

Details

Summary

This patch adds a helper class (CGLoopInfo) for marking memory instructions with llvm.mem.parallel_loop_access metadata.
It also adds a simple initial version of codegen for pragma omp simd (it will change in the future to support all the clauses).

Diff Detail

Repository
rL LLVM

Event Timeline

amusman updated this revision to Diff 9161.May 7 2014, 6:12 AM
amusman retitled this revision from to [OPENMP] A helper for marking intstructions with llvm.mem.parallel_loop_access.
amusman updated this object.
amusman edited the test plan for this revision. (Show Details)
amusman added a subscriber: Unknown Object (MLST).
hfinkel edited edge metadata.May 21 2014, 9:10 AM

With these changes, LGTM.

lib/CodeGen/CGBuilder.h
50 ↗(On Diff #9161)

This is now a lot of parameters to be duplicated in both sizes of the NDEBUG conditional. You can, for example, define a boolean that depends on NDEBUG and use that instead.

lib/CodeGen/CGLoopInfo.cpp
89 ↗(On Diff #9161)

This assert is not self explanatory. Please write:

assert(!Active.empty() && "No active loops to pop");

(or something like that).

115 ↗(On Diff #9161)

This is not quite complete. It misses memory intrinsics, for example. The check in LLVM's lib/Analysis/LoopInfo.cpp requires metadata on all instructions for which mayReadOrWriteMemory() returns true.

I think this can be:

if (L.getAttributes().IsParallel && I->mayReadOrWriteMemory())
  I->setMetadata("llvm.mem.parallel_loop_access", L.getLoopID());
lib/CodeGen/CodeGenFunction.cpp
1668 ↗(On Diff #9161)

Same comment here (don't duplicate all of this, just use a boolean or some other mechanism).

amusman closed this revision.May 22 2014, 2:01 AM
amusman updated this revision to Diff 9680.

Closed by commit rL209411 (authored by @amusman).