[llvm] [SCCP] Simplify [us]cmp(X, Y) into X - Y (PR #144717)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 19 09:09:48 PDT 2025
================
@@ -245,11 +245,46 @@ static Value *simplifyInstruction(SCCPSolver &Solver,
const APInt *RHSC;
// Remove masking operations.
if (match(&Inst, m_And(m_Value(X), m_LowBitMask(RHSC)))) {
- ConstantRange LRange = GetRange(Inst.getOperand(0));
+ ConstantRange LRange = GetRange(X);
if (LRange.getUnsignedMax().ule(*RHSC))
return X;
}
+ if (auto *II = dyn_cast<IntrinsicInst>(&Inst)) {
----------------
nikic wrote:
Could do this to skip the IID checks:
```suggestion
if (auto *Cmp = dyn_cast<CmpIntrinsic>(&Inst)) {
```
https://github.com/llvm/llvm-project/pull/144717
More information about the llvm-commits
mailing list