[llvm] [Instcombine]: Folds`llvm.ucmp` and `llvm.scmp` (PR #168505)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 29 09:48:19 PST 2025


================
@@ -808,5 +808,97 @@ define i1 @icmp_lt_slt(i1 %c, i32 %arg) {
   ret i1 %select
 }
 
+define i32 @fold_ucmp(i32 %0, i32 %1) {
+; CHECK-LABEL: @fold_ucmp(
+; CHECK-NEXT:    [[TMP3:%.*]] = tail call i32 @llvm.ucmp.i32.i32(i32 [[TMP0:%.*]], i32 [[TMP1:%.*]])
+; CHECK-NEXT:    ret i32 [[TMP3]]
+;
+  %3 = icmp eq i32 %0, %1
----------------
nikic wrote:

```suggestion
  %cmp = icmp eq i32 %arg1, %arg2
```
Etc. Prefer named values in tests.

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


More information about the llvm-commits mailing list