[all-commits] [llvm/llvm-project] 19841e: [OpenMP] Fix transformed loop's var privacy
Joel E. Denny via All-commits
all-commits at lists.llvm.org
Fri Jun 2 09:19:43 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 19841e4dcaabe573d35eb88a130fc34d32ecd708
https://github.com/llvm/llvm-project/commit/19841e4dcaabe573d35eb88a130fc34d32ecd708
Author: Joel E. Denny <jdenny.ornl at gmail.com>
Date: 2023-06-02 (Fri, 02 Jun 2023)
Changed paths:
M clang/lib/Sema/SemaOpenMP.cpp
M clang/test/OpenMP/unroll_codegen_parallel_for_factor.cpp
A openmp/libomptarget/test/offloading/target-tile.c
Log Message:
-----------
[OpenMP] Fix transformed loop's var privacy
Without this patch, the following example crashes Clang:
```
#pragma omp target map(i)
#pragma omp tile sizes(2)
for (i = 0; i < N; ++i)
;
```
This patch fixes the crash by changing `Sema::isOpenMPPrivateDecl` not
to identify `i` as private just because it's the loop variable of a
`tile` construct.
While OpenMP TR11 and earlier do specify privacy for loop variables of
loops *generated* from a `tile` construct, I haven't found text
stating that the original loop variable must be private in the above
example, so this patch leaves it shared. Even so, it is a bit
unexpected that value of `i` after the loop is `N - 1` instead of `N`.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D151356
More information about the All-commits
mailing list