[Mlir-commits] [mlir] [MLIR][Presburger] Make IntegerRelation::convertVarKind consistent wi… (PR #67323)
Kunwar Grover
llvmlistbot at llvm.org
Mon Sep 25 05:48:44 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;
+
// Append new local variables corresponding to the dimensions to be converted.
- unsigned convertCount = varLimit - varStart;
- unsigned newVarsBegin = insertVar(dstKind, pos, convertCount);
+ unsigned newVarsBegin = insertVar(dstKind, dstPos, num);
// Swap the new local variables with dimensions.
//
- // Essentially, this moves the information corresponding to the specified ids
+ // Essentially, this moves the constraints corresponding to the specified ids
----------------
Groverkss wrote:
This documentation needs to be updated, but not as part of this patch maybe.
https://github.com/llvm/llvm-project/pull/67323
More information about the Mlir-commits
mailing list