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

This commit is contained in:
Arjun P 2022-04-12 13:04:56 +01:00
parent 4e83d4fd92
commit 0ac213667d
1 changed files with 1 additions and 0 deletions

View File

@ -324,6 +324,7 @@ int64_t presburger::normalizeRange(MutableArrayRef<int64_t> range) {
} }
void presburger::normalizeDiv(MutableArrayRef<int64_t> num, int64_t &denom) { 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); int64_t gcd = llvm::greatestCommonDivisor(gcdRange(num), denom);
for (int64_t &coeff : num) for (int64_t &coeff : num)
coeff /= gcd; coeff /= gcd;