[llvm] [llvm][InstCombine] Fold signum(x) into scmp(x, 0) (PR #143445)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 06:18:14 PDT 2025


================
@@ -473,3 +473,17 @@ define i8 @scmp_from_select_eq_and_gt_neg3(i32 %x, i32 %y) {
   %r = select i1 %eq, i8 0, i8 %sel1
   ret i8 %r
 }
+
+; Fold (x > -1) ? zext(x != 0), -1 to scmp(x, 0)
+define i32 @scmp_x_0_from_gt_minus_1(i32 noundef %0) local_unnamed_addr #0 {
----------------
nikic wrote:

```suggestion
define i32 @scmp_x_0_from_gt_minus_1(i32 %0) {
```

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


More information about the llvm-commits mailing list