[llvm] [ValueTracking] isNonZero sub of ptr2int's with recursive GEP (PR #68680)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 18 03:30:06 PST 2023


================
@@ -2365,9 +2365,69 @@ static bool isNonZeroAdd(const APInt &DemandedElts, unsigned Depth,
       .isNonZero();
 }
 
+// Check to see if A is both a GEP and is the incoming value for a PHI in the
----------------
nikic wrote:

Actually, I don't think we need this. Can you please rebase this on top of https://github.com/llvm/llvm-project/commit/337504683efa0b898bcf69b4e5be67d73dbaf180 and then add the ptrtoint handling inside isKnownNonEqual()? I think that is the cleanest way to handle this.

isKnownNonZero for sub will call isKnownNonEqual, that will look through ptrtoint and call itself recursively, and at that point we'll handle the GEP case. This will make sure that if we add any extra pointer cases, we'll automatically make use of them as well.

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


More information about the llvm-commits mailing list