[Mlir-commits] [mlir] 64740ed - mlir/Presburger: optimize normalizeDiv when gcd=1 (#97893)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Jul 8 00:28:57 PDT 2024
Author: Ramkumar Ramachandra
Date: 2024-07-08T08:28:53+01:00
New Revision: 64740edac8d62a477701a9f089d89a654a004b22
URL: https://github.com/llvm/llvm-project/commit/64740edac8d62a477701a9f089d89a654a004b22
DIFF: https://github.com/llvm/llvm-project/commit/64740edac8d62a477701a9f089d89a654a004b22.diff
LOG: mlir/Presburger: optimize normalizeDiv when gcd=1 (#97893)
Added:
Modified:
mlir/lib/Analysis/Presburger/Utils.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Analysis/Presburger/Utils.cpp b/mlir/lib/Analysis/Presburger/Utils.cpp
index 9b32972de2e0a2..383888c3b5660e 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;
More information about the Mlir-commits
mailing list