[llvm] [InstCombine] Fold `scmp(x -nsw y, 0)` to `scmp(x, y)` (PR #105583)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 01:28:04 PDT 2024


dtcxzyw wrote:

> A peculiarity of cmp intrinsics is that they do not canonicalize constants to the right (as that inverts the result), so technically there is also this conjugate pattern with 0 on the LHS: https://alive2.llvm.org/ce/z/TApp6E But probably in practice the 0 will still be on the right, normally.

Distribution on llvm-opt-benchmark:
```
            LHSC   RHSC
SCmp  2            853
UCmp 3893      17
```


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


More information about the llvm-commits mailing list