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

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 10:12:40 PDT 2019


jdoerfert marked 2 inline comments as done.
jdoerfert added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:556
+        Pred, Incoming, RHS,
+        {Q.DL, Q.TLI, Q.DT, Q.AC, InTI, Q.IIQ.UseInstrInfo}, MaxRecurse);
     // If the operation failed to simplify, or simplified to a different value
----------------
nikic wrote:
> You can use `Q.getWithInstruction(InTI)` here.
Thx, will do.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:1906
+  if (isa<Constant>(V))
+    return false;
 
----------------
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.


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