[PATCH] D82614: ValueTracking: Fix isKnownNonZero for non-0 null pointers for byval

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 17:29:43 PDT 2020


efriedma added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2379
+      // a check for the default address space. However, it seems some users are
+      // relying on this, so leave this as broken for now.
+      if (((A->hasPassPointeeByValueAttr() && PtrTy->getAddressSpace() == 0) ||
----------------
LangRef says nonnnull means "not the value null", and the value null is an all-zero bit pattern.  That's maybe not ideal for some targets, sure, but I don't think there's a reason to call it out here specifically.  If we decide to change the meaning of the attributes in question, we'll audit all the users.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2380
+      // relying on this, so leave this as broken for now.
+      if (((A->hasPassPointeeByValueAttr() && PtrTy->getAddressSpace() == 0) ||
+           A->hasNonNullAttr()))
----------------
Please use NullPointerIsDefined.


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

https://reviews.llvm.org/D82614





More information about the llvm-commits mailing list