[llvm] [SCEV] Merge udiv exact logic into general udiv logic (PR #195840)

Ryan Buchner via llvm-commits llvm-commits at lists.llvm.org
Tue May 5 10:27:40 PDT 2026


https://github.com/bababuck requested changes to this pull request.

Looks like we're still missing the logic for the factorization in `getUDivExpr()` (and also test coverage).
```
      // We can't just assume that LHSCst divides RHSCst cleanly, it could be
      // that there's a factor provided by one of the other terms. We need to
      // check.
```
the following now fails, passes without this patch (I just wrote this locally, isn't present on `main`):
```
  EXPECT_EQ(SE.getUDivExactExpr(SE.getMulExpr({X, Six}, SCEV::FlagNUW), Four),
                      SE.getUDivExactExpr(SE.getMulExpr({X, Three}, SCEV::FlagNUW), Two));
```

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


More information about the llvm-commits mailing list