This patch generates some helper variables that used as private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by copy using values of the original variables (with the copy constructor, if any). For arrays, initializator is generated for single element and in the codegen procedure this initial value is automatically propagated between all elements of the private copy.
In outlined function, references to original variables are replaced by the references to these private helper variables. At the end of the initialization of the private variables an implicit barier is generated by calling __kmpc_barrier(...) runtime function to be sure that all threads were initialized using original values of the variables.
Details
- Reviewers
rjmccall • fraggamuffin • ejstotzer hfinkel rsmith doug.gregor - Commits
- rC219306: [OPENMP] Codegen for 'firstprivate' clause.
rC219297: [OPENMP] Codegen for 'firstprivate' clause.
rC219295: [OPENMP] Codegen for 'firstprivate' clause.
rL219306: [OPENMP] Codegen for 'firstprivate' clause.
rL219297: [OPENMP] Codegen for 'firstprivate' clause.
rL219295: [OPENMP] Codegen for 'firstprivate' clause.
Diff Detail
- Repository
- rL LLVM
Event Timeline
Please separate out the Sema changes from this patch into a separate patch.
lib/CodeGen/CGExpr.cpp | ||
---|---|---|
3483 ↗ | (On Diff #13135) | I don't think there is any reason to move this function to a different file. You can update its signature in-place. If you want to move it to a different file for organizational reasons, please do that in a separate commit. |
lib/CodeGen/CGStmtOpenMP.cpp | ||
58 ↗ | (On Diff #13135) | Please extract this into a utility function. |
- Original Message -----
From: "Alexey Bataev" <a.bataev@hotmail.com>
To: "a bataev" <a.bataev@hotmail.com>, dgregor@apple.com, fraggamuffin@gmail.com, richard@metafoo.co.uk,
rjmccall@gmail.com, ejstotzer@gmail.com, hfinkel@anl.gov
Cc: cfe-commits@cs.uiuc.edu
Sent: Monday, September 22, 2014 11:26:56 PM
Subject: Re: [PATCH] [OPENMP] Codegen for 'firstprivate' clause in 'parallel' directivePlease separate out the Sema changes from this patch into a
separate patch.Hal, the changes in Sema are required for codegen only. I won't be
able to test them without codegen.
Okay, obviously there are changes to the Sema tests because the messages have changed. Can you commit that change separately? If this is not reasonable/possible, please explain why.
Also, regarding the addition of the '*PrivateCopies' functions to the AST nodes, can you please explain the design? I don't understand why you seem to be duplicating some of the variables in the AST.
Thanks again,
Hal
[snip]