[llvm] [InstCombine] Use samesign constraints in unsigned known-bits folds (PR #209097)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 09:48:50 PDT 2026


================
@@ -6991,6 +6991,22 @@ Instruction *InstCombinerImpl::foldICmpUsingKnownBits(ICmpInst &I) {
       return &I;
   }
 
+  // If an unsigned samesign comparison is not poison, both operands have the
+  // same sign bit. Propagate a known sign bit between the temporary KnownBits
+  // values so the existing range folds can use that constraint.
+  if (I.hasSameSign() && I.isUnsigned()) {
----------------
dtcxzyw wrote:

Is this change needed to be put in the same patch as the `getFlippedStrictnessPredicateAndConstant` change?


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


More information about the llvm-commits mailing list