[llvm] [InstCombine] Fix i1 ssub.sat compare folding (PR #173742)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 11 19:29:34 PST 2026


================
@@ -3878,7 +3878,10 @@ Instruction *InstCombinerImpl::foldICmpEqIntrinsicWithConstant(
 
   case Intrinsic::ssub_sat:
     // ssub.sat(a, b) == 0 -> a == b
-    if (C.isZero())
+    //
+    // Note this doesn't work for ssub.sat.i1 because ssub.sat.i1 1, 0 = 0
----------------
dtcxzyw wrote:

ssub.sat.i1 (%x, 0) should always return `%x`. Isn't it `ssub.sat.i1 0, 1 = 0`?

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


More information about the llvm-commits mailing list