[PATCH] D49931: [CUDA][HIP] Allow function-scope static const variable

2018-07-27 Thread Yaxun Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC338188: [CUDA][HIP] Allow function-scope static const variable (authored by yaxunl, committed by ). Repository: rC Clang https://reviews.llvm.org/D49931 Files: include/clang/Basic/DiagnosticSemaKind

[PATCH] D49931: [CUDA][HIP] Allow function-scope static const variable

2018-07-27 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 157778. yaxunl marked an inline comment as done. yaxunl added a comment. Revised by Artem's comments. https://reviews.llvm.org/D49931 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/CodeGen/CodeGenModule.cpp lib/Sema/SemaDecl.cpp test/CodeGenCU

[PATCH] D49931: [CUDA][HIP] Allow function-scope static const variable

2018-07-27 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked an inline comment as done. yaxunl added inline comments. Comment at: lib/Sema/SemaDecl.cpp:11923-11930 + if (getLangOpts().CUDA && + !(VD->hasAttr() || +(VD->getType().isConstQualified() && + !VD->hasAttr() && + !VD-

[PATCH] D49931: [CUDA][HIP] Allow function-scope static const variable

2018-07-27 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. Looks OK overall except for the huge `if` below. Comment at: lib/Sema/SemaDecl.cpp:11923-11930 + if (getLangOpts().CUDA && + !(VD->hasAttr() || +(VD->getType().isConstQualified() && + !VD->hasAttr() && + !VD

[PATCH] D49931: [CUDA][HIP] Allow function-scope static const variable

2018-07-27 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In https://reviews.llvm.org/D49931#1178720, @tra wrote: > > This patch also allows function-scope static const variable without device > > memory qualifier and emits it as a global variable in constant address > > space. > > What does NVCC do with local static const vari

[PATCH] D49931: [CUDA][HIP] Allow function-scope static const variable

2018-07-27 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. > This patch also allows function-scope static const variable without device > memory qualifier and emits it as a global variable in constant address space. What does NVCC do with local static const variables? https://reviews.llvm.org/D49931

[PATCH] D49931: [CUDA][HIP] Allow function-scope static const variable

2018-07-27 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 157740. yaxunl edited the summary of this revision. yaxunl added a comment. update diagnostic message. https://reviews.llvm.org/D49931 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/CodeGen/CodeGenModule.cpp lib/Sema/SemaDecl.cpp test/CodeGenC

[PATCH] D49931: [CUDA][HIP] Allow function-scope static const variable

2018-07-27 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision. yaxunl added reviewers: tra, rjmccall. CUDA 8.0 E.3.9.4 says: Within the body of a __device__ or __global__ function, only __shared__ variables or variables without any device memory qualifiers may be declared with static storage class. It is unclear how a function-s