[Mlir-commits] [mlir] [mlir][Interfaces][NFC] `ValueBoundsConstraintSet`: Add columns for constant values/dims (PR #86097)

Nicolas Vasilache llvmlistbot at llvm.org
Mon Mar 25 02:14:30 PDT 2024


================
@@ -107,25 +107,57 @@ AffineExpr ValueBoundsConstraintSet::getExpr(Value value,
   assertValidValueDim(value, dim);
 #endif // NDEBUG
 
+  // Helper function that returns an affine expression that represents column
+  // `pos` in the constraint set.
+  auto getPosExpr = [&](int64_t pos) {
+    assert(pos >= 0 && pos < cstr.getNumDimAndSymbolVars() &&
+           "invalid position");
+    return pos < cstr.getNumDimVars()
----------------
nicolasvasilache wrote:

This ternary condition feels like an implementation detail that appears everywhere.
Can we give it a proper name and hide away the impl ?

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


More information about the Mlir-commits mailing list