[PATCH] D147597: [InstCombine] Fold icmp(bin(X, Y) | LHS, RHS) --> icmp(bin(X, Y)) iff LHS > RHS s>= 0

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 7 10:48:51 PDT 2023


goldstein.w.n added a comment.

In D147597#4251580 <https://reviews.llvm.org/D147597#4251580>, @junaire wrote:

> Hi @goldstein.w.n, please discard all my previous comments (sorry Phab doesn't allow me to delete inline comments :(
>
> So I agree with you with `m_BinOp` is unnecessary and the transform is correct. Please take a look at https://alive2.llvm.org/ce/z/97gSUu
> In fact, I guess we can add more generalized patterns based on the relation between LHS and RHS?

Ah, so `sle` -> `slt`. I missed that.

Since this is a bit complicated can you do two things.

1. make alive2 links for all cases (`sgt`, `slt`, `sge`, `sle`)
2. Comment in the code the exact transformations that are taking place (in the switch would make sense).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147597



More information about the llvm-commits mailing list