This patch generates call to "kmpc_push_num_threads(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_threads);" library function before calling "kmpc_fork_call" each time there is an associated "num_threads" clause in the "omp parallel" directive.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
include/clang/AST/StmtOpenMP.h | ||
---|---|---|
131 ↗ | (On Diff #13153) | Make it "Gets a single" or "Gets the single" |
132 ↗ | (On Diff #13153) | Also, make it clear that this asserts if there is more than one clause of the specified kind. |
lib/AST/Stmt.cpp | ||
1396 ↗ | (On Diff #13153) | "is at least" -> "are at least" |
lib/Sema/SemaOpenMP.cpp | ||
2592 ↗ | (On Diff #13153) | Do you need all of these checks, or is value-dependent enough? |
2613 ↗ | (On Diff #13153) | While it is true that omp_get/set_num_threads uses 'int' to represent the number of threads, I think this cast (trunc/ext) to int32_t should be done in CodeGen, not here (it is runtime specific -- the AST should retain the original type). |
test/OpenMP/parallel_num_threads_codegen.cpp | ||
5 ↗ | (On Diff #13153) | Don't need include-guards here. |
test/OpenMP/parallel_num_threads_codegen.cpp | ||
---|---|---|
5 ↗ | (On Diff #13153) | n/m -- as you pointed out in the other review, these are needed because of the PCH testing. |
include/clang/AST/StmtOpenMP.h | ||
---|---|---|
131 ↗ | (On Diff #13153) | Ok |
132 ↗ | (On Diff #13153) | Ok |
lib/AST/Stmt.cpp | ||
1396 ↗ | (On Diff #13153) | Fixed |
lib/Sema/SemaOpenMP.cpp | ||
2592 ↗ | (On Diff #13153) | I think we need all of them, because num_threads argument is not a constant, but an expression. |
2613 ↗ | (On Diff #13153) | Ok, I'll fix it. |
lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
2592 ↗ | (On Diff #13153) | I'm not sure; I think this is worth testing. A similar issue same up with the patches for the assume_aligned attribute, and it turned out that only the ValueDependent check was needed. Note that sizeof(T), for example, is value-dependent, not type-dependent. |
lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
2592 ↗ | (On Diff #13153) | Here are some excerpts from the header: |
lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
2592 ↗ | (On Diff #13153) | Ah, you're right. num_threads is not necessarily a compile-time constant, so the situation is different. |