[PATCH] D54956: [ValueTracking] Look through casts when determining non-nullness

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 28 11:27:21 PST 2018


efriedma added inline comments.


================
Comment at: lib/Analysis/ValueTracking.cpp:2034
+          Q.DL.getTypeSizeInBits(P2I->getDestTy()))
+        return isKnownNonZero(P2I->getOperand(0), Depth, Q);
+
----------------
This will never trigger: a ptrtoint produces an int, but the code is guarded by `V->getType()->isPointerTy()`.


================
Comment at: lib/Analysis/ValueTracking.cpp:2042
+    if (auto *ZEO = dyn_cast<ZExtOperator>(V))
+      return isKnownNonZero(ZEO->getOperand(0), Depth, Q);
+
----------------
zext/sext produces an int, but this is guarded by `V->getType()->isPointerTy()`.  And we check for zext/sext a few lines later anyway.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D54956





More information about the llvm-commits mailing list