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

Bharathi Ramana Joshi llvmlistbot at llvm.org
Mon Sep 25 05:59:54 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;
----------------
iambrj wrote:

I'm not sure how else to preserve the identifier information in the space as the IntegerRelation::convertVarKind algorithm inserts and deletes vars without preserving the identifier information. How do you suggest preserving the identifier information? Also, this patch does not change any of the insert/delete var function calls, so I'm not sure if the patch qualifies as changing the IntegerRelation::convertVarKind algorithm.

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


More information about the Mlir-commits mailing list