[Mlir-commits] [mlir] [MLIR][Presburger] Use Identifiers outside Presburger library (PR #77316)

Bharathi Ramana Joshi llvmlistbot at llvm.org
Fri Apr 5 11:03:31 PDT 2024


================
@@ -272,11 +274,15 @@ class FlatLinearValueConstraints : public FlatLinearConstraints {
   FlatLinearValueConstraints(const IntegerPolyhedron &fac,
                              ArrayRef<std::optional<Value>> valArgs = {})
       : FlatLinearConstraints(fac) {
-    assert(valArgs.empty() || valArgs.size() == getNumDimAndSymbolVars());
+    // Do not reset values assigned by FlatLinearConstraints' constructor.
     if (valArgs.empty())
-      values.resize(getNumDimAndSymbolVars(), std::nullopt);
-    else
-      values.append(valArgs.begin(), valArgs.end());
+      return;
+    assert(valArgs.size() == getNumDimAndSymbolVars());
+    // Store Values in space's identifiers.
+    space.resetIds();
+    for (unsigned i = 0, e = valArgs.size(); i < e; ++i)
+      if (valArgs[i])
+        setValue(i, *valArgs[i]);
----------------
iambrj wrote:

added comment in FlatLinearValueConstraints' constructor [here](https://github.com/llvm/llvm-project/pull/77316/files#diff-e77afb47e1a45788a8eb369ae11eb5303a9d0c554b7686bb7baf1dae1f5372beR208)

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


More information about the Mlir-commits mailing list