[OpenMP] Avoid VLAs for some reductions on array sections
In some cases the compiler can deduce the length of an array section as constants. With this information, VLAs can be avoided in place of a constant sized array or even a scalar value if the length is 1. Example: int a[4], b[2]; pragma omp parallel reduction(+: a[1:2], b[1:1]) { } For chained array sections, this optimization is restricted to cases where all array sections except the last have a constant length 1. This trivially guarantees that there are no holes in the memory region that needs to be privatized. Example: int c[3][4]; pragma omp parallel reduction(+: c[1:1][1:2]) { } Differential Revision: https://reviews.llvm.org/D39136 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316229 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- lib/CodeGen/CGOpenMPRuntime.cpp 4 additions, 6 deletionslib/CodeGen/CGOpenMPRuntime.cpp
- lib/CodeGen/CGStmtOpenMP.cpp 5 additions, 2 deletionslib/CodeGen/CGStmtOpenMP.cpp
- lib/Sema/SemaOpenMP.cpp 82 additions, 1 deletionlib/Sema/SemaOpenMP.cpp
- test/OpenMP/for_reduction_codegen.cpp 243 additions, 46 deletionstest/OpenMP/for_reduction_codegen.cpp
- test/OpenMP/for_reduction_codegen_UDR.cpp 79 additions, 54 deletionstest/OpenMP/for_reduction_codegen_UDR.cpp
Loading
Please register or sign in to comment