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

Kunwar Grover llvmlistbot at llvm.org
Thu Sep 28 04:07:38 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:

Do you think you can send a patch that fixes the Identifier preservation and then send this patch? Ideally, this patch should just be a API change.

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


More information about the Mlir-commits mailing list