[Mlir-commits] [mlir] [MLIR] check resource attr of module in TEST(Bytecode, MultiModuleWithResource) (PR #119618)

Soren Lassen llvmlistbot at llvm.org
Wed Dec 11 13:56:20 PST 2024


https://github.com/sorenlassen created https://github.com/llvm/llvm-project/pull/119618

`checkResourceAttribute` accidentally ignored its argument and only checked `roundTripModule` and not `module`

>From d73c41aab66bfd24726214dbba098f02ee85296d Mon Sep 17 00:00:00 2001
From: Soren Lassen <sorenlassen at gmail.com>
Date: Wed, 11 Dec 2024 13:30:14 -0800
Subject: [PATCH 1/2] fix checkResourceAttribute(*module)

---
 mlir/unittests/Bytecode/BytecodeTest.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mlir/unittests/Bytecode/BytecodeTest.cpp b/mlir/unittests/Bytecode/BytecodeTest.cpp
index baf5d5c650e309..47b323ab9bd7aa 100644
--- a/mlir/unittests/Bytecode/BytecodeTest.cpp
+++ b/mlir/unittests/Bytecode/BytecodeTest.cpp
@@ -69,8 +69,8 @@ TEST(Bytecode, MultiModuleWithResource) {
     GTEST_SKIP();
 
   // Try to see if we have a valid resource in the parsed module.
-  auto checkResourceAttribute = [&](Operation *op) {
-    Attribute attr = roundTripModule->getDiscardableAttr("bytecode.test");
+  auto checkResourceAttribute = [](Operation *op) {
+    Attribute attr = op->getDiscardableAttr("bytecode.test");
     ASSERT_TRUE(attr);
     auto denseResourceAttr = dyn_cast<DenseI32ResourceElementsAttr>(attr);
     ASSERT_TRUE(denseResourceAttr);

>From 95e5467e28fabdc9614f48b4a5769cb12060ac21 Mon Sep 17 00:00:00 2001
From: Soren Lassen <sorenlassen at gmail.com>
Date: Wed, 11 Dec 2024 13:48:26 -0800
Subject: [PATCH 2/2] rename checkResourceAttribute arg to parsedModule

---
 mlir/unittests/Bytecode/BytecodeTest.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mlir/unittests/Bytecode/BytecodeTest.cpp b/mlir/unittests/Bytecode/BytecodeTest.cpp
index 47b323ab9bd7aa..cb915a092a0be8 100644
--- a/mlir/unittests/Bytecode/BytecodeTest.cpp
+++ b/mlir/unittests/Bytecode/BytecodeTest.cpp
@@ -69,8 +69,8 @@ TEST(Bytecode, MultiModuleWithResource) {
     GTEST_SKIP();
 
   // Try to see if we have a valid resource in the parsed module.
-  auto checkResourceAttribute = [](Operation *op) {
-    Attribute attr = op->getDiscardableAttr("bytecode.test");
+  auto checkResourceAttribute = [](Operation *parsedModule) {
+    Attribute attr = parsedModule->getDiscardableAttr("bytecode.test");
     ASSERT_TRUE(attr);
     auto denseResourceAttr = dyn_cast<DenseI32ResourceElementsAttr>(attr);
     ASSERT_TRUE(denseResourceAttr);



More information about the Mlir-commits mailing list