yaxunl added inline comments.
================
Comment at: lib/CodeGen/CGDecl.cpp:235-240
+ if (Ty.getAddressSpace() != LangAS::opencl_local &&
+ !(getLangOpts().CUDA && getLangOpts().CUDAIsDevice &&
+ D.hasAttr<CUDASharedAttr>()))
Init = EmitNullConstant(Ty);
else
Init = llvm::UndefValue::get(LTy);
----------------
rjmccall wrote:
> tra wrote:
> > This is too hard to read. Inverting it makes it somewhat easier to
> > understand -- `either opencl_local or device-side CUDA shared are undef`.
> > ```
> > if (Ty.getAddressSpace() == LangAS::opencl_local
> > || (getLangOpts().CUDA && getLangOpts().CUDAIsDevice &&
> > D.hasAttr<CUDASharedAttr>()))
> > Init = llvm::UndefValue::get(LTy);
> > else
> > Init = EmitNullConstant(Ty);
> > ```
> >
> I assume getLangOpts().CUDAIsDevice implies getLangOpts().CUDA, so you really
> only need to check CUDAIsDevice. But it might be faster still to just check
> for the attribute.
Right. I think only attribute needs to be checked.
https://reviews.llvm.org/D44985
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits