[Mlir-commits] [mlir] [MLIR][Presburger] Make IntegerRelation::convertVarKind consistent wi… (PR #67323)

Kunwar Grover llvmlistbot at llvm.org
Mon Sep 25 05:48:45 PDT 2023


================
@@ -1317,31 +1318,43 @@ void IntegerRelation::removeRedundantLocalVars() {
   }
 }
 
-void IntegerRelation::convertVarKind(VarKind srcKind, unsigned varStart,
-                                     unsigned varLimit, VarKind dstKind,
-                                     unsigned pos) {
-  assert(varLimit <= getNumVarKind(srcKind) && "Invalid id range");
+void IntegerRelation::convertVarKind(VarKind srcKind, unsigned srcPos,
+                                     unsigned num, VarKind dstKind,
+                                     unsigned dstPos) {
+  unsigned varLimit = srcPos + num;
+  assert(srcKind != dstKind && "cannot convert variables to the same kind");
+  assert(varLimit <= getNumVarKind(srcKind) &&
+         "invalid range for source variables");
+  assert(dstPos <= getNumVarKind(dstKind) &&
+         "invalid position for destination variables");
 
-  if (varStart >= varLimit)
+  if (srcPos >= varLimit)
     return;
 
+  // Save the space as the insert/delete vars operations affect the identifier
+  // information in the space.
+  PresburgerSpace oldSpace = space;
----------------
Groverkss wrote:

I would not change the algorithm in this patch. A seperate patch should be better for algorithmic changes.

https://github.com/llvm/llvm-project/pull/67323


More information about the Mlir-commits mailing list