[Mlir-commits] [mlir] [MLIR][Bytecode] Enforce alignment requirements (PR #157004)

Mehdi Amini llvmlistbot at llvm.org
Fri Sep 5 04:15:16 PDT 2025


================
@@ -117,6 +119,57 @@ TEST(Bytecode, MultiModuleWithResource) {
   checkResourceAttribute(*roundTripModule);
 }
 
+TEST(Bytecode, AlignmentFailure) {
+  MLIRContext context;
+  Builder builder(&context);
+  ParserConfig parseConfig(&context);
+  OwningOpRef<Operation *> module =
+      parseSourceString<Operation *>(irWithResources, parseConfig);
+  ASSERT_TRUE(module);
+
+  // Write the module to bytecode.
+  MockOstream ostream;
+  EXPECT_CALL(ostream, reserveExtraSpace).WillOnce([&](uint64_t space) {
+    ostream.buffer = std::make_unique<std::byte[]>(space);
+    ostream.size = space;
+  });
----------------
joker-eph wrote:

What is the point of this EXPECT_CALL? Can you please document this?

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


More information about the Mlir-commits mailing list