[llvm] [SCEV] Preserve divisibility info when creating UMax/SMax expressions. (PR #160012)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 8 09:16:55 PDT 2025
================
@@ -15768,7 +15773,8 @@ void ScalarEvolution::LoopGuards::collectFromBlock(
// Return true if Expr known to divide by \p DividesBy.
std::function<bool(const SCEV *, const SCEV *&)> IsKnownToDivideBy =
[&](const SCEV *Expr, const SCEV *DividesBy) {
- if (SE.getURemExpr(Expr, DividesBy)->isZero())
+ if (Expr->getType()->isIntegerTy() &&
----------------
fhahn wrote:
`getConstantMultiple` can return a value multiple for pointers, whereas the code before only handled integers. We could also update `HasDivisibiltyInfo` to bail out for pointers. I am planning on extending this for pointers in a follow-up.
https://github.com/llvm/llvm-project/pull/160012
More information about the llvm-commits
mailing list