[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:13 PST 2025
================
@@ -1088,10 +1084,10 @@ unsigned IntegerRelation::gaussianEliminateVars(unsigned posStart,
unsigned pivotCol = 0;
for (pivotCol = posStart; pivotCol < posLimit; ++pivotCol) {
// Find a row which has a non-zero coefficient in column 'j'.
- unsigned pivotRow;
- if (!findConstraintWithNonZeroAt(pivotCol, /*isEq=*/true, &pivotRow)) {
+ std::optional<unsigned> pivotRow;
+ if (!(pivotRow = findConstraintWithNonZeroAt(pivotCol, /*isEq=*/true))) {
// No pivot row in equalities with non-zero at 'pivotCol'.
- if (!findConstraintWithNonZeroAt(pivotCol, /*isEq=*/false, &pivotRow)) {
+ if (!(pivotRow = findConstraintWithNonZeroAt(pivotCol, /*isEq=*/false))) {
----------------
Superty wrote:
Worth noting that this value of pivotRow from the second call isn't used here, so the assignment isn't needed. Here and above it's cleaner IMO to assign the optional directly and check !optional
https://github.com/llvm/llvm-project/pull/128993
More information about the Mlir-commits
mailing list