[PATCH] D142830: [ValueTracking] Improve non-zero tracking of `X` by also searching through `Use(X)` that imply non-zero

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 29 13:21:09 PST 2023


goldstein.w.n marked 2 inline comments as done.
goldstein.w.n added a comment.

In D142830#4088647 <https://reviews.llvm.org/D142830#4088647>, @nikic wrote:

> We should be testing canonical IR here (use `-passes=instcombine`), at which point many of these should already be handled. E.g. if you have a condition `abs(X) != 0`, that should get canonicalized to `X != 0` first, and then handled by existing code.

Done, my goal was to try and isolate the tests to test the added logic.

Updated to use instcombine and changed many of the compares so they don't hit the canonicalization cases.



================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2431
+        if (auto *II = dyn_cast<IntrinsicInst>(OpU)) {
+          switch (II->getIntrinsicID()) {
+          case Intrinsic::abs:
----------------
StephenFan wrote:
> IIUC, Intrinsic::umin may also imply non-zero. 
> IIUC, Intrinsic::umin may also imply non-zero. 

Would rather make this another patch if thats okay with you.
this one is mostly to setup the infrastructure.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142830



More information about the llvm-commits mailing list