[OPENMP]Fix PR46146: Do not consider globalized variables as NRVO candidates.
authorAlexey Bataev <a.bataev@hotmail.com>
Mon, 1 Jun 2020 16:39:25 +0000 (12:39 -0400)
committerAlexey Bataev <a.bataev@hotmail.com>
Thu, 4 Jun 2020 16:33:25 +0000 (12:33 -0400)
commit9ca5a6d3b523688be8b4c2315482297fa943c777
tree457d836a8d4cae3ecb090b4b61cb1834831900a6
parent68dd32dd43a21ecc898a0cad511fb0f18383e25d
[OPENMP]Fix PR46146: Do not consider globalized variables as NRVO candidates.

Summary:
If the variables must be globalized in OpenMP mode (local automatic
variable, GPU compilation mode, the variable may escape its declaration
context by the reference or by the pointer), it should not be considered
as the NRVO candidate. Otherwise, incorrect the return value of the
function might not be updated.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, sstefan1, cfe-commits, caomhin

Tags: #clang

Differential Revision: https://reviews.llvm.org/D80936
clang/lib/CodeGen/CGStmt.cpp
clang/test/OpenMP/nvptx_NRVO_variable.cpp [new file with mode: 0644]