[llvm] [CVP] #114820 add 'samesign' for 'icmp' (PR #115642)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 10 01:05:12 PST 2024
================
@@ -288,24 +289,37 @@ static bool processICmp(ICmpInst *Cmp, LazyValueInfo *LVI) {
if (!Cmp->getOperand(0)->getType()->isIntOrIntVectorTy())
return false;
- if (!Cmp->isSigned())
+ if (!(Cmp->isSigned() || (Cmp->isUnsigned() && !Cmp->hasSameSign())))
return false;
- ICmpInst::Predicate UnsignedPred =
- ConstantRange::getEquivalentPredWithFlippedSignedness(
- Cmp->getPredicate(),
- LVI->getConstantRangeAtUse(Cmp->getOperandUse(0),
- /*UndefAllowed*/ true),
- LVI->getConstantRangeAtUse(Cmp->getOperandUse(1),
- /*UndefAllowed*/ true));
+ bool Changed = false;
- if (UnsignedPred == ICmpInst::Predicate::BAD_ICMP_PREDICATE)
- return false;
+ ConstantRange CR1 = LVI->getConstantRangeAtUse(Cmp->getOperandUse(0),
+ /*UndefAllowed*/ true),
+ CR2 = LVI->getConstantRangeAtUse(Cmp->getOperandUse(1),
+ /*UndefAllowed*/ true);
----------------
dtcxzyw wrote:
```suggestion
ConstantRange CR1 = LVI->getConstantRangeAtUse(Cmp->getOperandUse(0),
/*UndefAllowed=*/true),
CR2 = LVI->getConstantRangeAtUse(Cmp->getOperandUse(1),
/*UndefAllowed=*/true);
```
https://github.com/llvm/llvm-project/pull/115642
More information about the llvm-commits
mailing list