[llvm] [SCEVDivision] Add SCEVDivisionPrinterPass with corresponding tests (PR #155832)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 28 07:05:41 PDT 2025
================
@@ -0,0 +1,210 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s "-passes=print<scev-division>" -disable-output 2>&1 | FileCheck %s
+
+define i8 @add(i8 %x, i8 %y) {
+; CHECK-LABEL: 'add'
+; CHECK-NEXT: Instruction: %div = sdiv i8 %add, %y
+; CHECK-NEXT: Numerator: (%x + %y)
+; CHECK-NEXT: Denominator: %y
+; CHECK-NEXT: Quotient: 1
+; CHECK-NEXT: Remainder: %x
+;
+ %add = add i8 %x, %y
+ %div = sdiv i8 %add, %y
+ ret i8 %div
+}
----------------
nikic wrote:
Assuming that the SCEVDivision contract is that `Numerator == (Quotient * Denominator + Remainder)`, then this result is correct, as `%x + %y == 1 * $x + %y`.
https://github.com/llvm/llvm-project/pull/155832
More information about the llvm-commits
mailing list