aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Passes/PassBuilder.cpp
diff options
context:
space:
mode:
authorRyotaro Kasuga <kasuga.ryotaro@fujitsu.com>2025-08-29 19:28:02 +0900
committerGitHub <noreply@github.com>2025-08-29 10:28:02 +0000
commit6ed64df443f55b6f4cf07cc58f38b9da54176243 (patch)
tree591665514fdf046be9c4570ea85feccba1225454 /llvm/lib/Passes/PassBuilder.cpp
parentd3517b65b91dc9a63a75ffa4f9d918cd5f4b7646 (diff)
downloadllvm-6ed64df443f55b6f4cf07cc58f38b9da54176243.zip
llvm-6ed64df443f55b6f4cf07cc58f38b9da54176243.tar.gz
llvm-6ed64df443f55b6f4cf07cc58f38b9da54176243.tar.bz2
[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
Diffstat (limited to 'llvm/lib/Passes/PassBuilder.cpp')
-rw-r--r--llvm/lib/Passes/PassBuilder.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index b7edeea..d75304b 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -69,6 +69,7 @@
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
+#include "llvm/Analysis/ScalarEvolutionDivision.h"
#include "llvm/Analysis/ScopedNoAliasAA.h"
#include "llvm/Analysis/StackLifetime.h"
#include "llvm/Analysis/StackSafetyAnalysis.h"