[Mlir-commits] [mlir] [MLIR][Bytecode] Use consistent types for resolveEntry (PR #171502)

Aiden Grossman llvmlistbot at llvm.org
Tue Dec 9 12:53:12 PST 2025


https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/171502

uint64_t and size_t are not the same across all platforms. This was causing build failures when building this file for wasm:

llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1323:19: error: out-of-line definition of 'resolveEntry' does not match any declaration in '(anonymous namespace)::AttrTypeReader'
 1323 | T AttrTypeReader::resolveEntry(SmallVectorImpl<Entry<T>> &entries, size_t index,
      |                   ^~~~~~~~~~~~
third_party/llvm/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:851:7: note: AttrTypeReader defined here
  851 | class AttrTypeReader {
      |       ^~~~~~~~~~~~~~
1 error generated.

Use uint64_t everywhere to ensure portability.

>From bf0093988bbf5532832c07f12f56181909f1b0c2 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Tue, 9 Dec 2025 20:51:38 +0000
Subject: [PATCH] [MLIR][Bytecode] Use consistent types for resolveEntry

uint64_t and size_t are not the same across all platforms. This was
causing build failures when building this file for wasm:

llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1323:19: error: out-of-line definition of 'resolveEntry' does not match any declaration in '(anonymous namespace)::AttrTypeReader'
 1323 | T AttrTypeReader::resolveEntry(SmallVectorImpl<Entry<T>> &entries, size_t index,
      |                   ^~~~~~~~~~~~
third_party/llvm/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:851:7: note: AttrTypeReader defined here
  851 | class AttrTypeReader {
      |       ^~~~~~~~~~~~~~
1 error generated.

Use uint64_t everywhere to ensure portability.
---
 mlir/lib/Bytecode/Reader/BytecodeReader.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
index dd367b5922558..0ac5fc5358ea5 100644
--- a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
+++ b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
@@ -1320,8 +1320,9 @@ LogicalResult AttrTypeReader::initialize(
 }
 
 template <typename T>
-T AttrTypeReader::resolveEntry(SmallVectorImpl<Entry<T>> &entries, size_t index,
-                               StringRef entryType, uint64_t depth) {
+T AttrTypeReader::resolveEntry(SmallVectorImpl<Entry<T>> &entries,
+                               uint64_t index, StringRef entryType,
+                               uint64_t depth) {
   if (index >= entries.size()) {
     emitError(fileLoc) << "invalid " << entryType << " index: " << index;
     return {};



More information about the Mlir-commits mailing list