[Mlir-commits] [mlir] 0ac2136 - [MLIR][Presburger] normalizeDiv: add assert that denom > 0

Arjun P llvmlistbot at llvm.org
Tue Apr 12 05:06:43 PDT 2022


Author: Arjun P
Date: 2022-04-12T13:06:53+01:00
New Revision: 0ac213667df1afbba3f66cb4fc3ec51073b9c158

URL: https://github.com/llvm/llvm-project/commit/0ac213667df1afbba3f66cb4fc3ec51073b9c158
DIFF: https://github.com/llvm/llvm-project/commit/0ac213667df1afbba3f66cb4fc3ec51073b9c158.diff

LOG: [MLIR][Presburger] normalizeDiv: add assert that denom > 0

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 77230fc825dc0..d25d03447e9ab 100644
--- a/mlir/lib/Analysis/Presburger/Utils.cpp
+++ b/mlir/lib/Analysis/Presburger/Utils.cpp
@@ -324,6 +324,7 @@ int64_t presburger::normalizeRange(MutableArrayRef<int64_t> range) {
 }
 
 void presburger::normalizeDiv(MutableArrayRef<int64_t> num, int64_t &denom) {
+  assert(denom > 0 && "denom must be positive!");
   int64_t gcd = llvm::greatestCommonDivisor(gcdRange(num), denom);
   for (int64_t &coeff : num)
     coeff /= gcd;


        


More information about the Mlir-commits mailing list