[llvm] [InstCombine] Add missing patterns for scmp and ucmp (PR #149225)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 18 10:19:46 PDT 2025


================
@@ -3849,6 +3853,45 @@ Instruction *InstCombinerImpl::foldSelectToCmp(SelectInst &SI) {
     }
   }
 
+  // Special cases with constants: x == C ? 0 : (x > C-1 ? 1 : -1)
+  if (Pred == ICmpInst::ICMP_EQ && match(TV, m_Zero())) {
+    Value *X;
----------------
dtcxzyw wrote:

X is unused.

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


More information about the llvm-commits mailing list