[clang] [clang-tools-extra] [llvm] [mlir] [clang][lldb][mlir] Fix some identical sub-expressions warnings (NFC) (PR #95715)

2024-06-17 Thread Arjun P via cfe-commits
https://github.com/Superty edited https://github.com/llvm/llvm-project/pull/95715 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [llvm] [mlir] [clang][lldb][mlir] Fix some identical sub-expressions warnings (NFC) (PR #95715)

2024-06-17 Thread Arjun P via cfe-commits
@@ -104,8 +104,9 @@ Simplex::Unknown &SimplexBase::unknownFromRow(unsigned row) { unsigned SimplexBase::addZeroRow(bool makeRestricted) { // Resize the tableau to accommodate the extra row. + unsigned oldNumRows = getNumRows(); unsigned newRow = tableau.appendExtraRow()

[clang] [clang-tools-extra] [llvm] [mlir] [clang][lldb][mlir] Fix some identical sub-expressions warnings (NFC) (PR #95715)

2024-06-17 Thread Arjun P via cfe-commits
@@ -104,8 +104,9 @@ Simplex::Unknown &SimplexBase::unknownFromRow(unsigned row) { unsigned SimplexBase::addZeroRow(bool makeRestricted) { // Resize the tableau to accommodate the extra row. + unsigned oldNumRows = getNumRows(); unsigned newRow = tableau.appendExtraRow()

[clang] [clang-tools-extra] [compiler-rt] [flang] [libc] [lld] [lldb] [llvm] [mlir] [openmp] [llvm-project] Fix typo "seperate" (PR #95373)

2024-06-13 Thread Arjun P via cfe-commits
https://github.com/Superty approved this pull request. https://github.com/llvm/llvm-project/pull/95373 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [MLIR][Presburger] Implement matrix inverse (PR #67382)

2023-10-17 Thread Arjun P via cfe-commits
@@ -432,4 +432,138 @@ MPInt IntMatrix::normalizeRow(unsigned row, unsigned cols) { MPInt IntMatrix::normalizeRow(unsigned row) { return normalizeRow(row, getNumColumns()); +} + +MPInt IntMatrix::determinant() { + unsigned r = getNumRows(); + unsigned c = getNumColumns();

[clang-tools-extra] [MLIR][Presburger] Implement matrix inverse (PR #67382)

2023-10-13 Thread Arjun P via cfe-commits
@@ -390,4 +463,83 @@ MPInt IntMatrix::normalizeRow(unsigned row, unsigned cols) { MPInt IntMatrix::normalizeRow(unsigned row) { return normalizeRow(row, getNumColumns()); +} + +std::optional IntMatrix::integerInverse() { + Fraction det = Fraction(determinant(), 1); + Frac

[clang-tools-extra] [MLIR][Presburger] Implement matrix inverse (PR #67382)

2023-10-13 Thread Arjun P via cfe-commits
@@ -390,4 +463,83 @@ MPInt IntMatrix::normalizeRow(unsigned row, unsigned cols) { MPInt IntMatrix::normalizeRow(unsigned row) { return normalizeRow(row, getNumColumns()); +} + +std::optional IntMatrix::integerInverse() { + Fraction det = Fraction(determinant(), 1); + Frac

[clang] [MLIR][Presburger] Implement matrix inverse (PR #67382)

2023-10-13 Thread Arjun P via cfe-commits
https://github.com/Superty requested changes to this pull request. https://github.com/llvm/llvm-project/pull/67382 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [MLIR][Presburger] Implement matrix inverse (PR #67382)

2023-10-13 Thread Arjun P via cfe-commits
@@ -283,12 +326,43 @@ template bool Matrix::hasConsistentState() const { return true; } +template +T Matrix::determinant() { + unsigned r = getNumRows(); + unsigned c = getNumColumns(); + if (r == 1) +return at(0, 0); + if (r == 2) +return (at(0, 0) * at(1, 1)

[clang] [MLIR][Presburger] Implement matrix inverse (PR #67382)

2023-10-13 Thread Arjun P via cfe-commits
@@ -390,4 +463,83 @@ MPInt IntMatrix::normalizeRow(unsigned row, unsigned cols) { MPInt IntMatrix::normalizeRow(unsigned row) { return normalizeRow(row, getNumColumns()); +} + +std::optional IntMatrix::integerInverse() { + Fraction det = Fraction(determinant(), 1); + Frac

[clang-tools-extra] [MLIR][Presburger] Implement matrix inverse (PR #67382)

2023-10-13 Thread Arjun P via cfe-commits
@@ -241,6 +245,32 @@ class IntMatrix : public Matrix /// Returns the GCD of the columns of the specified row. MPInt normalizeRow(unsigned row); + // Return the integer inverse of the matrix, leaving the calling object + // unmodified. + std::optional integerInverse(); +

[clang-tools-extra] [MLIR][Presburger] Fix reduce bug in Fraction class and add tests (PR #68298)

2023-10-06 Thread Arjun P via cfe-commits
https://github.com/Superty closed https://github.com/llvm/llvm-project/pull/68298 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [MLIR][Presburger] Fix reduce bug in Fraction class and add tests (PR #68298)

2023-10-06 Thread Arjun P via cfe-commits
Superty wrote: Thanks! https://github.com/llvm/llvm-project/pull/68298 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [MLIR][Presburger] Fix reduce bug in Fraction class and add tests (PR #68298)

2023-10-06 Thread Arjun P via cfe-commits
Superty wrote: Thanks! https://github.com/llvm/llvm-project/pull/68298 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [MLIR][Presburger] Fix reduce bug in Fraction class and add tests (PR #68298)

2023-10-06 Thread Arjun P via cfe-commits
https://github.com/Superty closed https://github.com/llvm/llvm-project/pull/68298 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [MLIR][Presburger] Fix reduce bug in Fraction class and add tests (PR #68298)

2023-10-05 Thread Arjun P via cfe-commits
@@ -0,0 +1,51 @@ +#include "mlir/Analysis/Presburger/Fraction.h" +#include "./Utils.h" +#include +#include + +using namespace mlir; +using namespace presburger; + +TEST(FractionTest, getAsInteger) { + Fraction f(3, 1); + EXPECT_EQ(f.getAsInteger(), MPInt(3)); +} + +TEST(Fracti

[clang-tools-extra] [MLIR][Presburger] Fix reduce bug in Fraction class and add tests (PR #68298)

2023-10-05 Thread Arjun P via cfe-commits
https://github.com/Superty requested changes to this pull request. https://github.com/llvm/llvm-project/pull/68298 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [MLIR][Presburger] Fix reduce bug in Fraction class and add tests (PR #68298)

2023-10-05 Thread Arjun P via cfe-commits
@@ -0,0 +1,51 @@ +#include "mlir/Analysis/Presburger/Fraction.h" +#include "./Utils.h" +#include +#include + +using namespace mlir; +using namespace presburger; + +TEST(FractionTest, getAsInteger) { + Fraction f(3, 1); + EXPECT_EQ(f.getAsInteger(), MPInt(3)); +} + +TEST(Fracti

[clang] [MLIR][Presburger] Fix reduce bug in Fraction class and add tests (PR #68298)

2023-10-05 Thread Arjun P via cfe-commits
https://github.com/Superty edited https://github.com/llvm/llvm-project/pull/68298 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [MLIR][Presburger] Fix reduce bug in Fraction class and add tests (PR #68298)

2023-10-05 Thread Arjun P via cfe-commits
@@ -0,0 +1,51 @@ +#include "mlir/Analysis/Presburger/Fraction.h" +#include "./Utils.h" +#include +#include + +using namespace mlir; +using namespace presburger; + +TEST(FractionTest, getAsInteger) { + Fraction f(3, 1); + EXPECT_EQ(f.getAsInteger(), MPInt(3)); +} + +TEST(Fracti

[clang-tools-extra] [MLIR][Presburger] Fix reduce bug in Fraction class and add tests (PR #68298)

2023-10-05 Thread Arjun P via cfe-commits
@@ -0,0 +1,51 @@ +#include "mlir/Analysis/Presburger/Fraction.h" +#include "./Utils.h" +#include +#include + +using namespace mlir; +using namespace presburger; + +TEST(FractionTest, getAsInteger) { + Fraction f(3, 1); + EXPECT_EQ(f.getAsInteger(), MPInt(3)); +} + +TEST(Fracti

[clang] [MLIR][Presburger] Fix reduce bug in Fraction class and add tests (PR #68298)

2023-10-05 Thread Arjun P via cfe-commits
https://github.com/Superty requested changes to this pull request. https://github.com/llvm/llvm-project/pull/68298 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [MLIR][Presburger] Define matrix inverse for rational matrices (PR #67382)

2023-09-29 Thread Arjun P via cfe-commits
Superty wrote: By the way, what happens if the inverse doesn't exist? https://github.com/llvm/llvm-project/pull/67382 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [MLIR][Presburger] Define matrix inverse for rational matrices (PR #67382)

2023-09-29 Thread Arjun P via cfe-commits
Superty wrote: By the way, what happens if the inverse doesn't exist? https://github.com/llvm/llvm-project/pull/67382 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [MLIR][Presburger] Define matrix inverse for rational matrices (PR #67382)

2023-09-29 Thread Arjun P via cfe-commits
Superty wrote: By the way, what happens if the inverse doesn't exist? https://github.com/llvm/llvm-project/pull/67382 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [MLIR][Presburger] Define matrix inverse for rational matrices (PR #67382)

2023-09-28 Thread Arjun P via cfe-commits
https://github.com/Superty requested changes to this pull request. https://github.com/llvm/llvm-project/pull/67382 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [MLIR][Presburger] Define matrix inverse for rational matrices (PR #67382)

2023-09-28 Thread Arjun P via cfe-commits
@@ -102,7 +102,7 @@ inline bool operator>=(const Fraction &x, const Fraction &y) { inline Fraction reduce(const Fraction &f) { if (f == Fraction(0)) return Fraction(0, 1); - MPInt g = gcd(f.num, f.den); + MPInt g = gcd(abs(f.num), abs(f.den)); return Fraction(f.num

[clang-tools-extra] [MLIR][Presburger] Define matrix inverse for rational matrices (PR #67382)

2023-09-28 Thread Arjun P via cfe-commits
@@ -390,4 +390,68 @@ MPInt IntMatrix::normalizeRow(unsigned row, unsigned cols) { MPInt IntMatrix::normalizeRow(unsigned row) { return normalizeRow(row, getNumColumns()); +} + +FracMatrix FracMatrix::identity(unsigned dimension) { + FracMatrix matrix(dimension, dimension);

[clang] [MLIR][Presburger] Define matrix inverse for rational matrices (PR #67382)

2023-09-28 Thread Arjun P via cfe-commits
@@ -244,6 +244,31 @@ class IntMatrix : public Matrix }; +// An inherited class for rational matrices, with no new data attributes. +// This is only used for the matrix-related method which apply only +// to fractions (inverse). Superty wrote: "This class is

[clang-tools-extra] [MLIR][Presburger] Define matrix inverse for rational matrices (PR #67382)

2023-09-28 Thread Arjun P via cfe-commits
https://github.com/Superty edited https://github.com/llvm/llvm-project/pull/67382 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [MLIR][Presburger] Define matrix inverse for rational matrices (PR #67382)

2023-09-28 Thread Arjun P via cfe-commits
https://github.com/Superty requested changes to this pull request. https://github.com/llvm/llvm-project/pull/67382 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [MLIR][Presburger] Define matrix inverse for rational matrices (PR #67382)

2023-09-28 Thread Arjun P via cfe-commits
@@ -102,7 +102,7 @@ inline bool operator>=(const Fraction &x, const Fraction &y) { inline Fraction reduce(const Fraction &f) { if (f == Fraction(0)) return Fraction(0, 1); - MPInt g = gcd(f.num, f.den); + MPInt g = gcd(abs(f.num), abs(f.den)); return Fraction(f.num