[Mlir-commits] [mlir] c1fa817 - [mlir] Adjust AttributeTest to show skip behavior.
Adrian Kuegel
llvmlistbot at llvm.org
Mon Jan 30 23:50:51 PST 2023
Author: Adrian Kuegel
Date: 2023-01-31T08:50:32+01:00
New Revision: c1fa8179d4e5300a67ebdf41916a18f9c6330121
URL: https://github.com/llvm/llvm-project/commit/c1fa8179d4e5300a67ebdf41916a18f9c6330121
DIFF: https://github.com/llvm/llvm-project/commit/c1fa8179d4e5300a67ebdf41916a18f9c6330121.diff
LOG: [mlir] Adjust AttributeTest to show skip behavior.
walk() skips identical sub-attributes. Adjust the unit test to show
this.
Differential Revision: https://reviews.llvm.org/D142956
Added:
Modified:
mlir/unittests/IR/AttributeTest.cpp
Removed:
################################################################################
diff --git a/mlir/unittests/IR/AttributeTest.cpp b/mlir/unittests/IR/AttributeTest.cpp
index 7c0572ee89fe4..94345d00f1130 100644
--- a/mlir/unittests/IR/AttributeTest.cpp
+++ b/mlir/unittests/IR/AttributeTest.cpp
@@ -432,13 +432,15 @@ TEST(SubElementTest, Nested) {
BoolAttr trueAttr = builder.getBoolAttr(true);
BoolAttr falseAttr = builder.getBoolAttr(false);
- ArrayAttr boolArrayAttr = builder.getArrayAttr({trueAttr, falseAttr});
+ ArrayAttr boolArrayAttr =
+ builder.getArrayAttr({trueAttr, falseAttr, trueAttr});
StringAttr strAttr = builder.getStringAttr("array");
DictionaryAttr dictAttr =
builder.getDictionaryAttr(builder.getNamedAttr(strAttr, boolArrayAttr));
SmallVector<Attribute> subAttrs;
dictAttr.walk([&](Attribute attr) { subAttrs.push_back(attr); });
+ // Note that trueAttr appears only once, identical subattributes are skipped.
EXPECT_EQ(llvm::ArrayRef(subAttrs),
ArrayRef<Attribute>(
{strAttr, trueAttr, falseAttr, boolArrayAttr, dictAttr}));
More information about the Mlir-commits
mailing list