llvm-project/llvm/utils/UpdateTestChecks
Ryotaro Kasuga 6ed64df443
[SCEVDivision] Add SCEVDivisionPrinterPass with corresponding tests (#155832)
This patch introduces `SCEVDivisionPrinterPass` and registers it under
the name `print<scev-division>`, primarily for testing purposes. This
pass invokes `SCEVDivision::divide` upon encountering `sdiv`, and prints
the numerator, denominator, quotient, and remainder. It also adds
several test cases, some of which are currently incorrect and require
fixing.

Along with that, this patch added some comments to clarify the behavior
of `SCEVDivision::divide`, as follows:

- This function does NOT actually perform the division
- Given the `Numerator` and `Denominator`, find a pair 
  `(Quotient, Remainder)` s.t.
  `Numerator = Quotient * Denominator + Remainder`
- The common condition `Remainder < Denominator` is NOT necessarily
   required
- There may be multiple solutions for `(Quotient, Remainder)`, and this
   function finds one of them
  - Especially, there is always a trivial solution `(0, Numerator)`
- The following computations may wrap
  - The multiplication of `Quotient` and `Denominator`
  - The addition of `Quotient * Denominator` and `Remainder`

Related discussion: #154745
2025-08-29 10:28:02 +00:00
..