Skip to content

Commit c94405f

Browse files
committed
Fix duplicates and use increment operators for Fraction
1 parent 2c2909f commit c94405f

File tree

2 files changed

+2
-36
lines changed

2 files changed

+2
-36
lines changed

mlir/include/mlir/Analysis/Presburger/Fraction.h

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -147,40 +147,6 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Fraction &x) {
147147
return os;
148148
}
149149

150-
inline Fraction operator/(const Fraction &x, const Fraction &y) {
151-
return Fraction(x.num * y.den, x.den * y.num);
152-
}
153-
154-
inline Fraction operator+(const Fraction &x, const Fraction &y) {
155-
return Fraction(x.num * y.den + x.den * y.num, x.den * y.den);
156-
}
157-
158-
inline Fraction operator-(const Fraction &x, const Fraction &y) {
159-
return Fraction(x.num * y.den - x.den * y.num, x.den * y.den);
160-
}
161-
162-
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Fraction &x) {
163-
x.print(os);
164-
return os;
165-
}
166-
167-
inline Fraction operator/(const Fraction &x, const Fraction &y) {
168-
return Fraction(x.num * y.den, x.den * y.num);
169-
}
170-
171-
inline Fraction operator+(const Fraction &x, const Fraction &y) {
172-
return Fraction(x.num * y.den + x.den * y.num, x.den * y.den);
173-
}
174-
175-
inline Fraction operator-(const Fraction &x, const Fraction &y) {
176-
return Fraction(x.num * y.den - x.den * y.num, x.den * y.den);
177-
}
178-
179-
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Fraction &x) {
180-
x.print(os);
181-
return os;
182-
}
183-
184150
} // namespace presburger
185151
} // namespace mlir
186152

mlir/lib/Analysis/Presburger/Matrix.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ template <typename T> SmallVector<T, 8> Matrix<T>::preMultiplyWithRow(ArrayRef<T
237237
SmallVector<T, 8> result(getNumColumns(), T(0));
238238
for (unsigned col = 0, e = getNumColumns(); col < e; ++col)
239239
for (unsigned i = 0, e = getNumRows(); i < e; ++i)
240-
result[col] = result[col] + rowVec[i] * at(i, col);
240+
result[col] += rowVec[i] * at(i, col);
241241
return result;
242242
}
243243

@@ -249,7 +249,7 @@ Matrix<T>::postMultiplyWithColumn(ArrayRef<T> colVec) const {
249249
SmallVector<T, 8> result(getNumRows(), T(0));
250250
for (unsigned row = 0, e = getNumRows(); row < e; row++)
251251
for (unsigned i = 0, e = getNumColumns(); i < e; i++)
252-
result[row] = result[row] + at(row, i) * colVec[i];
252+
result[row] += at(row, i) * colVec[i];
253253
return result;
254254
}
255255

0 commit comments

Comments
 (0)