[llvm-branch-commits] [clang] [llvm] [clang][OpenMP] Emit lastprivate final copies in no-loop kernels (PR #224045)

Nicole Aschenbrenner via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Oct 30 03:21:56 PDT 2026


nicebert wrote:

> Using text from the commit message, can you explain why you are "forcing the exit barrier the copy reads through"? And can it be optimized for no-wait?

The barrier was there because I carried over the rule from clang's regular worksharing loop, which emits the end-of-loop barrier even with nowait when there is a lastprivate. The wording in the commit message was wrong, the copy doesn't depend on it: only the thread that executed the last iteration does the copy, and it reads its own private copy and its own last-iteration flag, so it doesn't wait on any other thread. The end of the parallel region already synchronizes all threads after the copy. So yes, with nowait the barrier can be dropped, which I did in a2a1471e8d21, and I updated the PR description accordingly.

https://github.com/llvm/llvm-project/pull/224045


More information about the llvm-branch-commits mailing list