[Mlir-commits] [mlir] [mlirbc] Add AffineMap serialization support (PR #191970)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Apr 13 23:46:03 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- mlir/lib/IR/BuiltinDialectBytecode.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/lib/IR/BuiltinDialectBytecode.cpp b/mlir/lib/IR/BuiltinDialectBytecode.cpp
index 7225abe82..9bb6e4a71 100644
--- a/mlir/lib/IR/BuiltinDialectBytecode.cpp
+++ b/mlir/lib/IR/BuiltinDialectBytecode.cpp
@@ -54,7 +54,7 @@ enum class AffineExprBytecodeKind : uint64_t {
 };
 
 static FailureOr<AffineExpr> readAffineExpr(DialectBytecodeReader &reader,
-                                             MLIRContext *context) {
+                                            MLIRContext *context) {
   uint64_t kind;
   if (failed(reader.readVarInt(kind)))
     return failure();
@@ -160,8 +160,7 @@ static void writeAffineExpr(DialectBytecodeWriter &writer, AffineExpr expr) {
 }
 
 static LogicalResult readAffineMap(DialectBytecodeReader &reader,
-                                   MLIRContext *context,
-                                   AffineMap &map) {
+                                   MLIRContext *context, AffineMap &map) {
   uint64_t numDims, numSymbols, numResults;
   if (failed(reader.readVarInt(numDims)) ||
       failed(reader.readVarInt(numSymbols)) ||
@@ -180,8 +179,7 @@ static LogicalResult readAffineMap(DialectBytecodeReader &reader,
   return success();
 }
 
-static void writeAffineMap(DialectBytecodeWriter &writer,
-                           AffineMapAttr attr) {
+static void writeAffineMap(DialectBytecodeWriter &writer, AffineMapAttr attr) {
   AffineMap map = attr.getValue();
   writer.writeVarInt(map.getNumDims());
   writer.writeVarInt(map.getNumSymbols());
@@ -195,8 +193,8 @@ static void writeAffineMap(DialectBytecodeWriter &writer,
 //===----------------------------------------------------------------------===//
 
 // Returns the bitwidth if known, else return 0.
-static std::optional<unsigned> getIntegerBitWidth(
-    DialectBytecodeReader &reader, Type type) {
+static std::optional<unsigned> getIntegerBitWidth(DialectBytecodeReader &reader,
+                                                  Type type) {
   if (auto intType = dyn_cast<IntegerType>(type))
     return intType.getWidth();
   if (llvm::isa<IndexType>(type))

``````````

</details>


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


More information about the Mlir-commits mailing list