[PATCH] D118153: [CUDA][HIP] Do not treat host var address as constant in device compilation

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 25 10:59:49 PST 2022


tra added a comment.

LGTM.

Do we need to do anything special about `__managed__` vars?



================
Comment at: clang/lib/AST/ExprConstant.cpp:2224
+          Info.getCtx().getLangOpts().CUDAIsDevice) {
+        if (!Var->hasAttr<CUDADeviceAttr>() &&
+            !Var->hasAttr<CUDAConstantAttr>() &&
----------------
Nit: Negations are my pet peeve. I think `if (!(A||B||C||D...))` would be easier to read -- `not (this or that or that)` has only N+1 operations to keep in one's head vs 2*N in `not this, and not that, and not that, and....`. In this case it's not too bad, so I'll leave it up to you which form you prefer.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118153/new/

https://reviews.llvm.org/D118153



More information about the cfe-commits mailing list