================
@@ -3500,10 +3503,14 @@ static LValue EmitGlobalVarDeclLValue(CodeGenFunction
&CGF,
return EmitThreadPrivateVarDeclLValue(CGF, VD, T, Addr, RealVarTy,
E->getExprLoc());
}
- LValue LV = VD->getType()->isReferenceType() ?
- CGF.EmitLoadOfReferenceLValue(Addr, VD->getType(),
- AlignmentSource::Decl) :
- CGF.MakeAddrLValue(Addr, T, AlignmentSource::Decl);
+ const bool IsReference = VD->getType()->isReferenceType();
+ LValue LV = IsReference ? CGF.EmitLoadOfReferenceLValue(Addr, VD->getType(),
+
AlignmentSource::Decl)
+ : CGF.MakeAddrLValue(Addr, T, AlignmentSource::Decl);
+ // Preserve CUDA constant storage information from the AST declaration.
+ if (!IsReference && CGF.getLangOpts().CUDAIsDevice &&
+ CGF.CGM.GetGlobalVarAddressSpace(VD) == LangAS::cuda_constant)
----------------
arsenm wrote:
Special casing an address space, there should be some predicate function that
tells you the global is invariant, not spread the language and address space
check here
https://github.com/llvm/llvm-project/pull/218356
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits