[llvm] [InstCombine] Use samesign constraints in unsigned known-bits folds (PR #209675)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 10 03:15:18 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()) {
----------------
dtcxzyw wrote:
```suggestion
if (I.hasSameSign()) {
```
samesign is independent of predicates.
https://github.com/llvm/llvm-project/pull/209675
More information about the llvm-commits
mailing list