[Mlir-commits] [mlir] mlir/Presburger: optimize normalizeDiv when gcd=1 (PR #97893)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Jul 6 05:17:08 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Ramkumar Ramachandra (artagnon)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/97893.diff
1 Files Affected:
- (modified) mlir/lib/Analysis/Presburger/Utils.cpp (+2)
``````````diff
diff --git a/mlir/lib/Analysis/Presburger/Utils.cpp b/mlir/lib/Analysis/Presburger/Utils.cpp
index 9b32972de2e0a..383888c3b5660 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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/97893
More information about the Mlir-commits
mailing list