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

Volodymyr Vasylkun via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 10:05:43 PDT 2024


Poseydon42 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?

It's already being folded as well if I'm not mistaken.

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


More information about the llvm-commits mailing list