[Mlir-commits] [mlir] [MLIR] Fix crash in AffineMap::replace for zero result maps (PR #80930)

Uday Bondhugula llvmlistbot at llvm.org
Wed Feb 7 00:27:02 PST 2024


================
@@ -122,9 +122,11 @@ class AffineMap {
   /// `exprs.size()`, as many dims as the largest dim in `exprs` and as many
   /// symbols as the largest symbol in `exprs`.
   static SmallVector<AffineMap, 4>
-  inferFromExprList(ArrayRef<ArrayRef<AffineExpr>> exprsList);
+  inferFromExprList(ArrayRef<ArrayRef<AffineExpr>> exprsList,
+                    MLIRContext *context);
   static SmallVector<AffineMap, 4>
-  inferFromExprList(ArrayRef<SmallVector<AffineExpr, 4>> exprsList);
+  inferFromExprList(ArrayRef<SmallVector<AffineExpr, 4>> exprsList,
+                    MLIRContext *context);
----------------
bondhugula wrote:

Unfortunately, the codebase isn't following a convention here, and things are being done both ways. Here's a crude search result from `llvm/mlir/`:
```
$ grep  ", context" lib/ -r | wc -l
216
grep  "(context, " lib/ -r | wc -l
247
$ grep  ", context)" lib/IR -r | wc -l
60
$ grep  "(context, " lib/IR -r | wc -l
34
```
>From a usage standpoint, I think having it as a trailing argument fits my mental model better, going by "important things come first." So, thinking of the key inputs when opening the parenthesis is natural, followed by the other baggage.

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


More information about the Mlir-commits mailing list