[PATCH] D104741: [SCEV] Support single-cond range check idiom in applyLoopGuards.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 22 15:09:20 PDT 2021


efriedma added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:13671
+          C1->getValue()->isMinusOne() && Predicate == CmpInst::ICMP_ULT &&
+          C2 && !C2->getAPInt().isMaxValue() && !C2->getAPInt().isNullValue()) {
+        auto *LHSUnknown = dyn_cast<SCEVUnknown>(AddExpr->getOperand(1));
----------------
Instead of trying to special-case `(-1 + X) u< C`, could you use ConstantRange::makeExactICmpRegion?  Not that this necessarily needs to be generalized, but it would be easier to follow the logic, I think.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104741/new/

https://reviews.llvm.org/D104741



More information about the llvm-commits mailing list