[PATCH] D147900: [ValueTracking] Use `select` condition to help determine if `select` is non-zero

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 13:50:27 PDT 2023


goldstein.w.n added a comment.

In D147900#4262716 <https://reviews.llvm.org/D147900#4262716>, @nikic wrote:

> Can you please base this on cmpExcludesZero() instead? I don't think there's need to handle cases here that we don't handle for assumes or branches.

Any chance you are okay leaving this as a todo. i.e
"TODO: Integrate these cases in `cmpExcludesZero`"

Personally don't like leaving known missed-optimizations on the table :(

Also feels like a different circumstance. Other uses of `cmpExcludesZero` are in
loops so there is a case for skipping the over-analysis. This, on the otherhand
is capped at +2 recursive calls (only for `ICMP_SGE`, the rest +1/+0).

ultimately up to you, so LMK.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147900



More information about the llvm-commits mailing list