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

Nikhil Kalra llvmlistbot at llvm.org
Fri Sep 5 09:29:07 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;
+  });
----------------
nikalra wrote:

I think I blindly copy/pasted this from the existing test. Removed it in this test, and added a comment for this call in the original test.
https://github.com/llvm/llvm-project/pull/157136

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


More information about the Mlir-commits mailing list