[llvm] [WIP] Consider datalayout sentinel pointer value for isKnownNonZero check (PR #91769)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sat May 11 00:50:11 PDT 2024


================
@@ -3098,6 +3098,15 @@ bool isKnownNonZero(const Value *V, const APInt &DemandedElts,
   // Check for pointer simplifications.
 
   if (PointerType *PtrTy = dyn_cast<PointerType>(Ty)) {
+    const DataLayout &DL = Q.DL;
+    if (DL.isSentinelValueDefined() && PtrTy) {
+      unsigned AddrSpace = PtrTy->getPointerAddressSpace();
+
+      if (DL.getSentinelPointerValue(AddrSpace) == 0)
+        return false;
+      return true;
----------------
arsenm wrote:

Fold to return of boolean expression 

https://github.com/llvm/llvm-project/pull/91769


More information about the llvm-commits mailing list