[all-commits] [llvm/llvm-project] e20d64: [Clang][OpenMP] Fixed an issue of segment fault wh...
Shilei Tian via All-commits
all-commits at lists.llvm.org
Mon Oct 26 19:33:38 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: e20d64c3d9d81cad701f31d8481367222c76c787
https://github.com/llvm/llvm-project/commit/e20d64c3d9d81cad701f31d8481367222c76c787
Author: Shilei Tian <tianshilei1992 at gmail.com>
Date: 2020-10-26 (Mon, 26 Oct 2020)
Changed paths:
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
A openmp/libomptarget/test/offloading/bug47654.cpp
Log Message:
-----------
[Clang][OpenMP] Fixed an issue of segment fault when using target nowait
The implementation of target nowait just wraps the target region into a task. The essential four parameters (base ptr, ptr, size, mapper) are taken as firstprivate such that they will be copied to the private location. When there is no user-defined mapper, the mapper variable will be nullptr. However, it will be still copied to the corresponding place. Therefore, a memcpy will be generated and the source pointer will be nullptr, causing a segmentation fault. The root cause is when calling `emitOffloadingArraysArgument`, the last argument `Options` has a field about whether it requires a task. It only takes depend clause into account. In this patch, the nowait clause is also included.
There're two things that will be done in another patches:
1. target data nowait has not been supported yet. D90099 added the support.
2. When there is no mapper, the mapper array can be nullptr no matter whether it requires outer task or not. It can avoid an unnecessary data copy. This is an optimization that is covered in D90101.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D89844
More information about the All-commits
mailing list