File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed
mlir/include/mlir/Analysis/Presburger Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -195,6 +195,7 @@ class MPInt {
195195 friend MPInt gcdRange (ArrayRef<MPInt> range);
196196 friend MPInt ceilDiv (const MPInt &lhs, const MPInt &rhs);
197197 friend MPInt floorDiv (const MPInt &lhs, const MPInt &rhs);
198+ // The operands must be non-negative for gcd.
198199 friend MPInt gcd (const MPInt &a, const MPInt &b);
199200 friend MPInt lcm (const MPInt &a, const MPInt &b);
200201 friend MPInt mod (const MPInt &lhs, const MPInt &rhs);
@@ -382,6 +383,7 @@ LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt mod(const MPInt &lhs, const MPInt &rhs) {
382383}
383384
384385LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt gcd (const MPInt &a, const MPInt &b) {
386+ assert (a >= 0 && b >= 0 && " operands must be non-negative!" );
385387 if (LLVM_LIKELY (a.isSmall () && b.isSmall ()))
386388 return MPInt (llvm::greatestCommonDivisor (a.getSmall (), b.getSmall ()));
387389 return MPInt (gcd (detail::SlowMPInt (a), detail::SlowMPInt (b)));
You can’t perform that action at this time.
0 commit comments