jfb added a comment.

I'm not sure I understand all the implications, and why that would / wouldn't 
be valid.

Should this be an builtin that can be called from C++ directly?



================
Comment at: clang/lib/CodeGen/CGExprScalar.cpp:2034
+      (AllOnes << 
llvm::Log2_64(DL.getPointerABIAlignment(static_cast<unsigned>(
+           CE->getSubExpr()->getType()->getPointeeType().getAddressSpace()))));
+  if (!BO->getRHS()->isIntegerConstantExpr(CV, Ctx) ||
----------------
This assumes pointers are max 64 bits :)
It seems better to shift `CV` up by `bit_per_byte*sizeof(void*) - 
max_pointer_size`, and then down to remove alignment, and finally checking that 
it's zero?

Which leads me to wonder: should we ever diagnose "bad" pointer masks?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64128



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to