[PATCH] D69571: [ValueTracking] Allow context-sensitive nullness check for non-pointers

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 23:09:36 PDT 2019


lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

Since the regression that reverted D60846 <https://reviews.llvm.org/D60846> appears to be resolved, LG.



================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:1906
+  if (isa<Constant>(V))
+    return false;
 
----------------
jdoerfert wrote:
> nikic wrote:
> > Why can't this be an assert? Looks like the Constant case is fully handled first in `isKnownNonZero()`.
> I thought so too, run it, and caused the assert to trigger. The last case has two `if`s nested. That is already a way out of the first case, might be more.
> 
> I don't think we want to look at dominance of constants (for now) so I just return false. There is actually something we could do here, but hat is a different story.
While there, should this be
```
  if (isa<Constant>(V))
    return isa<ConstantPointerNull>(V);
```
?


================
Comment at: llvm/test/Transforms/InstCombine/known-non-zero.ll:95
+
+; Test that exposed a bug in the PHI handling after D60846.
+define void @D60846_misompile(i1* %p) {
----------------
Precommit


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69571





More information about the llvm-commits mailing list