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

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 20:11:38 PDT 2026


================
@@ -7088,6 +7088,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()) {
----------------
imkiva wrote:

Ok. Thank you~

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


More information about the llvm-commits mailing list