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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue May 5 05:13:14 PDT 2026


================
@@ -3745,6 +3745,39 @@ const SCEV *ScalarEvolution::getUDivExactExpr(SCEVUse LHS, SCEVUse RHS) {
   // just deal with u/exact (multiply, constant). See SCEVDivision towards the
   // end of this file for inspiration.
 
+  if (LHS == RHS)
+    return getConstant(LHS->getType(), 1);
----------------
nikic wrote:

I think all of the logic in this function doesn't actually depend on exactness. Filed https://github.com/llvm/llvm-project/pull/195840 to remove it.

(The code originally handled non-nuw muls, but this was fixed in f1f49c82651af561fdcdab1528a1447da1254ace.)

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


More information about the llvm-commits mailing list