[llvm] [InstCombine] Fold `(x == y) ? 0 : (x > y ? 1 : -1)` into `ucmp/scmp(x,y)` (PR #107314)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 08:58:55 PDT 2024


goldsteinn wrote:

> > By inverse fold for you mean `x !- y ? x > y ? 1 : -1 : 0` or `x > y ? 1 : x == y ? 0 : -1`?
> 
> The former; it gets canonicalized into `x == y ? 0 : (x > y ? 1 : -1)`, which is then handled by this patch.

Any value in handling the latter?

https://github.com/llvm/llvm-project/pull/107314


More information about the llvm-commits mailing list