[PATCH] D145281: [InstCombine] Add transforms for `(icmp spred (xor X, Y), X)`

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 3 15:57:10 PST 2023


goldstein.w.n created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
goldstein.w.n requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

If we know the sign of Y or the value of Y we can either evaluate or
simplify the condition.

`icmp (X | MinInt) s> X` --> `false`

- https://alive2.llvm.org/ce/z/mpd-Yj

`icmp (X | MinInt) s<= X` --> `true`

- https://alive2.llvm.org/ce/z/E4aynv

`icmp (X | MinInt) s>= X` --> `X s< 0`

- https://alive2.llvm.org/ce/z/ThZkSV

`icmp (X | MinInt) s< X` --> `X s>= 0`

- https://alive2.llvm.org/ce/z/sNx2VB

`icmp (X | Pos_Y) s> X` --> `(X | Pos_Y) != X`

- https://alive2.llvm.org/ce/z/n-XM6N

`icmp (X | Pos_Y) s<= X` --> `(X | Pos_Y) == X`

- https://alive2.llvm.org/ce/z/1FQZM-


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145281

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/test/Transforms/InstCombine/icmp-of-or-x.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145281.502287.patch
Type: text/x-patch
Size: 5322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230303/9fb2f5a2/attachment.bin>


More information about the llvm-commits mailing list