[Mlir-commits] [mlir] Fix bug in `visitDivExpr`, `visitModExpr` and `visitMulExpr` (PR #145290)

Uday Bondhugula llvmlistbot at llvm.org
Fri Jun 27 04:44:39 PDT 2025


================
@@ -1274,6 +1273,27 @@ SimpleAffineExprFlattener::SimpleAffineExprFlattener(unsigned numDims,
   operandExprStack.reserve(8);
 }
 
+LogicalResult SimpleAffineExprFlattener::addExprToFlattenedList(
----------------
bondhugula wrote:

I think this is completely misnamed. Is this specific to semi-affine exprs? In fact, addLocalIdSemiAffine in any of its overrides doesn't even use `lhs` and `rhs`. So all of these arguments aren't making sense to me.

```
LogicalResult SimpleAffineExprFlattener::addLocalIdSemiAffine(
    ArrayRef<int64_t> lhs, ArrayRef<int64_t> rhs, AffineExpr localExpr) {
  for (SmallVector<int64_t, 8> &subExpr : operandExprStack)
    subExpr.insert(subExpr.begin() + getLocalVarStartIndex() + numLocals, 0);
  localExprs.push_back(localExpr);
  ++numLocals;
  // lhs and rhs are not used here; an override of this method uses them.
  return success();
}
```

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


More information about the Mlir-commits mailing list