[llvm] [SCEVDivision] Add SCEVDivisionPrinterPass with corresponding tests (PR #155832)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 28 06:51:20 PDT 2025


https://github.com/kasuga-fj commented:

While writing tests, I felt that we should first clarify the behavior of `SCEVDivision::divide`. Maybe something like the following?

- Given the `Numerator` and `Denominator`, find a pair `(Quotient, Remainder)` such that
    - `Numerator = Quotient * Denominator + Remainder`
    - The multiplication of `Quotient` and `Denominator` does not wrap in a signed sense
    - The addition of `Quotient*Denominator` and `Remainder` does not wrap in a signed sense
- The condition `Remainder < Denominator` is *not* necessarily required
- Multiple pairs `(Quotient, Remainder)` may satisfy the above conditions, and this function returns one of them
    - Especially, `(Quotient, Remainder) = (0, Numerator)` is a trivial one

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


More information about the llvm-commits mailing list