[PATCH] D109337: [GlobalOpt][FIX] Do not embed initializers into AS!=0 globals

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 7 14:43:38 PDT 2021


tra added inline comments.


================
Comment at: llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.h:52
+  bool canHaveNonUndefGlobalInitializerInAddressSpace(unsigned AS) const {
+    return AS != AddressSpace::ADDRESS_SPACE_SHARED;
+  }
----------------
jdoerfert wrote:
> tra wrote:
> > While we should not have globals with ADDRESS_SPACE_LOCAL  or ADDRESS_SPACE_PARAM, it may be worth to return false for them, too.
> That sounds to me more like an assertion. I'll add one for now, you let me know if that is ok too.
Assertions are for compiler programming errors, not for diagnosing invalid user-provided input.
Considering that one can write IR with a global var in an invalid AS I think assertion is not the right choice here.
An error would be more appropriate, IMO.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109337



More information about the llvm-commits mailing list