[llvm] [SCEVDivision] Add SCEVDivisionPrinterPass with corresponding tests (PR #155832)
Ryotaro Kasuga via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 29 02:50:08 PDT 2025
================
@@ -25,8 +25,19 @@ struct SCEVCouldNotCompute;
struct SCEVDivision : public SCEVVisitor<SCEVDivision, void> {
public:
- // Computes the Quotient and Remainder of the division of Numerator by
- // Denominator.
+ /// Computes the Quotient and Remainder of the division of Numerator by
+ /// Denominator. We are not actually performing the division here. Instead, we
+ /// are trying to find SCEV expressions Quotient and Remainder that satisfy:
+ ///
+ /// Numerator = Denominator * Quotient + Remainder
+ ///
+ /// There may be multiple valid answers for Quotient and Remainder. This
+ /// function finds one of them. Especially, there is always a trivial
+ /// solution: (Quotient, Remainder) = (0, Numerator).
+ ///
+ /// Note the following:
+ /// * The condition Remainder < Denominator is NOT necessarily required.
+ /// * Division of constants is performed as signed.
----------------
kasuga-fj wrote:
Added, thanks.
https://github.com/llvm/llvm-project/pull/155832
More information about the llvm-commits
mailing list