[PATCH] D142847: [InstCombine] reduce icmp_eq0-of-and-of-select-of-constants

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 09:38:19 PST 2023


goldstein.w.n accepted this revision.
goldstein.w.n added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:1896
+  // TODO: Generalize for non-constant values.
+  // TODO: Invert with a "ne" predicate.
+  // TODO: Extend to handle a non-zero compare constant.
----------------
You could also match other predicates i.e `((x?1:4)&(y?1:4))<2`

Also it seems we already have some logic for match some other predicates in this case (although I can't find it):
https://godbolt.org/z/hjzMGKqKz

although it seems to have an off by-1 issue (see `ugt` and `ugt3`)


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

https://reviews.llvm.org/D142847



More information about the llvm-commits mailing list