[llvm] [SCCP] Relax two-instruction range checks (PR #158495)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 15 10:02:27 PDT 2025
================
@@ -284,6 +286,54 @@ static Value *simplifyInstruction(SCCPSolver &Solver,
return Sub;
}
+ // Relax range checks.
+ if (auto *ICmp = dyn_cast<ICmpInst>(&Inst)) {
+ Value *X;
+ auto MatchTwoInstructionExactRangeCheck =
+ [&]() -> std::optional<ConstantRange> {
+ const APInt *RHSC;
+ if (!match(ICmp->getOperand(1), m_APInt(RHSC)))
+ return std::nullopt;
+
+ Value *LHS = ICmp->getOperand(0);
+ ICmpInst::Predicate Pred = ICmp->getPredicate();
+ const APInt *Offset;
+ if (match(LHS, m_OneUse(m_AddLike(m_Value(X), m_APInt(Offset)))))
----------------
andjo403 wrote:
is it not good to remove the dependency to the "add" even if there is muli use?
https://github.com/llvm/llvm-project/pull/158495
More information about the llvm-commits
mailing list