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

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 28 02:12:11 PST 2018


fhahn added a reviewer: efriedma.
fhahn added a comment.

The changes in ValueTracking.cpp look good to me, I am just adding Eli in case he has any additional thoughts.



================
Comment at: lib/Analysis/LazyValueInfo.cpp:1714
   if (V->getType()->isPointerTy() && C->isNullValue() &&
-      isKnownNonZero(V->stripPointerCasts(), DL)) {
+      isKnownNonZero(V, DL)) {
     if (Pred == ICmpInst::ICMP_EQ)
----------------
jdoerfert wrote:
> I'm not sure this is the right fix but I know we have to do something to pass "callsite_nonnull_args_through_casts.ll" with -O3 (even without my modifications below!).
> The alternative, making sure Value::stripPointerCasts() is not stripping of AddrSpaceCasts, makes more and more sense to me as I always assumed it not to change "the value".
I think this is an independent issue and should be addressed separately, assuming the test passes with instcombine.


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