Skip to content

Commit 1b088b3

Browse files
committed
use StringSet
1 parent 0b8d0ca commit 1b088b3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

mlir/lib/Dialect/Polynomial/IR/PolynomialAttributes.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "llvm/ADT/SmallSet.h"
1414
#include "llvm/ADT/StringExtras.h"
1515
#include "llvm/ADT/StringRef.h"
16+
#include "llvm/ADT/StringSet.h"
1617

1718
namespace mlir {
1819
namespace polynomial {
@@ -76,7 +77,7 @@ Attribute PolynomialAttr::parse(AsmParser &parser, Type type) {
7677
return {};
7778

7879
llvm::SmallVector<Monomial> monomials;
79-
llvm::SmallSet<std::string, 2> variables;
80+
llvm::StringSet<> variables;
8081
llvm::DenseSet<APInt> exponents;
8182

8283
while (true) {
@@ -127,7 +128,7 @@ Attribute PolynomialAttr::parse(AsmParser &parser, Type type) {
127128
}
128129

129130
if (variables.size() > 1) {
130-
std::string vars = llvm::join(variables.begin(), variables.end(), ", ");
131+
std::string vars = llvm::join(variables.keys(), ", ");
131132
parser.emitError(
132133
parser.getCurrentLocation(),
133134
"polynomials must have one indeterminate, but there were multiple: " +

mlir/test/Dialect/Polynomial/attributes.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: mlir-opt %s --split-input-file --verify-diagnostics
22

33
#my_poly = #polynomial.polynomial<y + x**1024>
4-
// expected-error@below {{polynomials must have one indeterminate, but there were multiple: y, x}}
4+
// expected-error@below {{polynomials must have one indeterminate, but there were multiple: x, y}}
55
#ring1 = #polynomial.ring<coefficientType=i32, coefficientModulus=2837465, polynomialModulus=#my_poly>
66

77
// -----

0 commit comments

Comments
 (0)