diff options
author | Ramkumar Ramachandra <ramkumar.ramachandra@codasip.com> | 2024-07-08 08:28:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-08 08:28:53 +0100 |
commit | 64740edac8d62a477701a9f089d89a654a004b22 (patch) | |
tree | 8044cc537e6ea2946c55803eb8d8e793c3ef47c1 /mlir/lib | |
parent | 5e136b7e0d310b368ce5025d55bfd7a376391199 (diff) | |
download | llvm-64740edac8d62a477701a9f089d89a654a004b22.zip llvm-64740edac8d62a477701a9f089d89a654a004b22.tar.gz llvm-64740edac8d62a477701a9f089d89a654a004b22.tar.bz2 |
mlir/Presburger: optimize normalizeDiv when gcd=1 (#97893)
Diffstat (limited to 'mlir/lib')
-rw-r--r-- | mlir/lib/Analysis/Presburger/Utils.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mlir/lib/Analysis/Presburger/Utils.cpp b/mlir/lib/Analysis/Presburger/Utils.cpp index 9b32972..383888c 100644 --- a/mlir/lib/Analysis/Presburger/Utils.cpp +++ b/mlir/lib/Analysis/Presburger/Utils.cpp @@ -362,6 +362,8 @@ void presburger::normalizeDiv(MutableArrayRef<DynamicAPInt> num, DynamicAPInt &denom) { assert(denom > 0 && "denom must be positive!"); DynamicAPInt gcd = llvm::gcd(gcdRange(num), denom); + if (gcd == 1) + return; for (DynamicAPInt &coeff : num) coeff /= gcd; denom /= gcd; |