================
@@ -432,7 +443,8 @@ void CodeGenFunction::EmitStaticVarDecl(const VarDecl &D,
bool isCudaSharedVar = getLangOpts().CUDA && getLangOpts().CUDAIsDevice &&
D.hasAttr<CUDASharedAttr>();
// If this value has an initializer, emit it.
- if (D.getInit() && !isCudaSharedVar) {
+ if (D.getInit() && !isCudaSharedVar &&
+ !(D.isUsableInConstantExpressions(getContext()) && D.isStaticLocal())) {
----------------
Fznamznon wrote:
> So I think D.isStaticLocal() is always true.
I would expect that from a function named `EmitStaticVarDecl`, however It is
not true at least for some OpenCL variables and if `-fmerge-all-constants` flag
is passed. Same goes for `getOrCreateStaticVarDecl` since it is called above. I
need to see what happens a bit more to avoid that check...
https://github.com/llvm/llvm-project/pull/156933
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits