[PATCH] D71660: [ValueTracking] isKnownNonZero() should take non-null-ness assumptions into consideration (PR43267)

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 12:03:50 PST 2019


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:648
+  return false;
+}
+
----------------
jdoerfert wrote:
> I'd move the `isValidAssumeForContext(I, Q.CxtI, Q.DT)` as early as possible, assuming I haven't overlooked a case where it is not called.
As `isValidAssumeForContext()` may need to perform a full block scan, I think it's preferable to check this condition last, and existing code seems to follow this, even if it means duplicating many isValidAssumeForContext() calls. I do agree though that it would be good to restructure the code in a way that only requires writing out the check once. Basically `return icmpImpliesNonZero() && isValidAssumeForContext()`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71660





More information about the llvm-commits mailing list