[llvm] [SCEV] Updates for getUDivExactExpr() to improve handling of MulExpr numerators/denominators (PR #195704)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Mon May 4 13:58:22 PDT 2026


================
@@ -3755,7 +3788,9 @@ const SCEV *ScalarEvolution::getUDivExactExpr(SCEVUse LHS, SCEVUse RHS) {
     if (const auto *LHSCst = dyn_cast<SCEVConstant>(Mul->getOperand(0))) {
       if (LHSCst == RHSCst) {
         SmallVector<SCEVUse, 2> Operands(drop_begin(Mul->operands()));
-        return getMulExpr(Operands);
+        return getMulExpr(
+            Operands, LHSCst->isZero() ? SCEVNoWrapFlags::FlagAnyWrap
----------------
efriedma-quic wrote:

I don't think it's possible for a SCEVMulExpr to have a constant zero as an operand.

https://github.com/llvm/llvm-project/pull/195704


More information about the llvm-commits mailing list