[Mlir-commits] [mlir] [MLIR] NFC. Improve API signature + clang-tidy warning in IntegerRelation (PR #128993)

Arjun P llvmlistbot at llvm.org
Fri Feb 28 04:57:12 PST 2025


================
@@ -1125,11 +1121,12 @@ unsigned IntegerRelation::gaussianEliminateVars(unsigned posStart,
 bool IntegerRelation::gaussianEliminate() {
   gcdTightenInequalities();
   unsigned firstVar = 0, vars = getNumVars();
-  unsigned nowDone, eqs, pivotRow;
+  unsigned nowDone, eqs;
+  std::optional<unsigned> pivotRow;
   for (nowDone = 0, eqs = getNumEqualities(); nowDone < eqs; ++nowDone) {
     // Finds the first non-empty column.
     for (; firstVar < vars; ++firstVar) {
-      if (!findConstraintWithNonZeroAt(firstVar, true, &pivotRow))
+      if (!(pivotRow = findConstraintWithNonZeroAt(firstVar, /*isEq=*/true)))
         continue;
       break;
----------------
Superty wrote:

if (pivotRow = ...)
  break;
  
is cleaner and then you can skip the continue

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


More information about the Mlir-commits mailing list