[llvm] [ConstraintElim] Use ConstantRange information for ConstraintElimination (PR #180862)
Manasij Mukherjee via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 17 22:19:47 PST 2026
================
@@ -1141,6 +1169,19 @@ void State::addInfoFor(BasicBlock &BB) {
continue;
WorkList.push_back(FactOrCheck::getCheck(DTN, &U));
}
+ // Target operands feeding into comparisons for computeConstantRange.
+ // Only explore two levels deep, and exclude eq and ne because of
+ // outsized compile time impact and marginal benefit.
+ if (!Cmp->isEquality()) {
+ for (Value *Op : Cmp->operands()) {
+ if (auto *OpI = dyn_cast<Instruction>(Op)) {
+ addConstantRangeFact(OpI, DT.getNode(OpI->getParent()));
+ for (Value *SubOp : OpI->operands())
+ if (auto *SubI = dyn_cast<Instruction>(SubOp))
+ addConstantRangeFact(SubI, DT.getNode(SubI->getParent()));
+ }
----------------
manasij7479 wrote:
I tried this, seems to make it significantly less effective.
https://github.com/llvm/llvm-project/pull/180862
More information about the llvm-commits
mailing list