[llvm] [InstCombine] Preserve samesign when flipping icmp strictness (PR #209097)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 20:51:12 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()) {
----------------
imkiva wrote:

Thanks. Opened #209675

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


More information about the llvm-commits mailing list