[llvm] InstCombine: Fold samesign ult to slt with added constant when the range is known (PR #134556)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 6 12:22:10 PDT 2025


================
@@ -3165,9 +3166,13 @@ Instruction *InstCombinerImpl::foldICmpAddConstant(ICmpInst &Cmp,
     // If there is overflow, the result must be true or false.
     // TODO: Can we assert there is no overflow because InstSimplify always
     // handles those cases?
-    if (!Overflow)
+    if (!Overflow) {
----------------
nikic wrote:

This looks incorrect as implemented, because the isSigned() check above still uses the original predicate. It would be good to add a test for a case where the ssub_ov vs usub_ov distinction is relevant.

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


More information about the llvm-commits mailing list