[Mlir-commits] [mlir] 3f9b044 - [mlir][Affine][NFC] Improve FlatAffineValueConstraint dump

Matthias Springer llvmlistbot at llvm.org
Tue Feb 28 00:23:22 PST 2023


Author: Matthias Springer
Date: 2023-02-28T09:23:13+01:00
New Revision: 3f9b0446f9a7595486233e2f70b57d903988442f

URL: https://github.com/llvm/llvm-project/commit/3f9b0446f9a7595486233e2f70b57d903988442f
DIFF: https://github.com/llvm/llvm-project/commit/3f9b0446f9a7595486233e2f70b57d903988442f.diff

LOG: [mlir][Affine][NFC] Improve FlatAffineValueConstraint dump

Improve indentation for better readability.

Before:
```
Domain: 0, Range: 2, Symbols: 2, Locals: 1
5 constraints
(None	Value	Value	Value	Local	const)
1 1 0 -1 0 0 = 0
0 1 -1 0 0 0 >= 0
0 0 1 -1 2 2 >= 0
0 0 -1 1 -2 -1 >= 0
0 -1 1 0 2 0 >= 0
```

After:
```
Domain: 0, Range: 2, Symbols: 2, Locals: 1
5 constraints
(None	Value	Value	Value	Local	const)
 1	1	0	-1	0	0	= 0
 0	1	-1	0	0	0	>= 0
 0	0	1	-1	2	2	>= 0
 0	0	-1	1	-2	-1	>= 0
 0	-1	1	0	2	0	>= 0
```

Differential Revision: https://reviews.llvm.org/D144854

Added: 
    

Modified: 
    mlir/lib/Analysis/Presburger/IntegerRelation.cpp
    mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Analysis/Presburger/IntegerRelation.cpp b/mlir/lib/Analysis/Presburger/IntegerRelation.cpp
index f421d05fa310e..75c6adbf6bbc2 100644
--- a/mlir/lib/Analysis/Presburger/IntegerRelation.cpp
+++ b/mlir/lib/Analysis/Presburger/IntegerRelation.cpp
@@ -2246,14 +2246,16 @@ void IntegerRelation::print(raw_ostream &os) const {
   assert(hasConsistentState());
   printSpace(os);
   for (unsigned i = 0, e = getNumEqualities(); i < e; ++i) {
+    os << " ";
     for (unsigned j = 0, f = getNumCols(); j < f; ++j) {
-      os << atEq(i, j) << " ";
+      os << atEq(i, j) << "\t";
     }
     os << "= 0\n";
   }
   for (unsigned i = 0, e = getNumInequalities(); i < e; ++i) {
+    os << " ";
     for (unsigned j = 0, f = getNumCols(); j < f; ++j) {
-      os << atIneq(i, j) << " ";
+      os << atIneq(i, j) << "\t";
     }
     os << ">= 0\n";
   }

diff  --git a/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
index f26a97c9f1f08..3e7d81113bcba 100644
--- a/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
@@ -1406,15 +1406,15 @@ void FlatAffineValueConstraints::printSpace(raw_ostream &os) const {
   os << "(";
   for (unsigned i = 0, e = getNumDimAndSymbolVars(); i < e; i++) {
     if (hasValue(i))
-      os << "Value ";
+      os << "Value\t";
     else
-      os << "None ";
+      os << "None\t";
   }
   for (unsigned i = getVarKindOffset(VarKind::Local),
                 e = getVarKindEnd(VarKind::Local);
        i < e; ++i)
-    os << "Local ";
-  os << " const)\n";
+    os << "Local\t";
+  os << "const)\n";
 }
 
 void FlatAffineValueConstraints::clearAndCopyFrom(


        


More information about the Mlir-commits mailing list