diff --git a/mlir/include/mlir/TableGen/CodeGenHelpers.h b/mlir/include/mlir/TableGen/CodeGenHelpers.h --- a/mlir/include/mlir/TableGen/CodeGenHelpers.h +++ b/mlir/include/mlir/TableGen/CodeGenHelpers.h @@ -114,7 +114,7 @@ /// /// Constraints that do not meet the restriction that they can only reference /// `$_self`, `$_op`, and `$_builder` are not uniqued. - void emitPatternConstraints(const DenseSet &constraints); + void emitPatternConstraints(const ArrayRef constraints); /// Get the name of the static function used for the given type constraint. /// These functions are used for operand and result constraints and have the @@ -178,7 +178,7 @@ /// Collect and unique all the constraints used by operations. void collectOpConstraints(ArrayRef opDefs); /// Collect and unique all pattern constraints. - void collectPatternConstraints(const DenseSet &constraints); + void collectPatternConstraints(ArrayRef constraints); /// The output stream. raw_ostream &os; diff --git a/mlir/tools/mlir-tblgen/CodeGenHelpers.cpp b/mlir/tools/mlir-tblgen/CodeGenHelpers.cpp --- a/mlir/tools/mlir-tblgen/CodeGenHelpers.cpp +++ b/mlir/tools/mlir-tblgen/CodeGenHelpers.cpp @@ -62,7 +62,7 @@ } void StaticVerifierFunctionEmitter::emitPatternConstraints( - const llvm::DenseSet &constraints) { + const llvm::ArrayRef constraints) { collectPatternConstraints(constraints); emitPatternConstraints(); } @@ -332,7 +332,7 @@ } void StaticVerifierFunctionEmitter::collectPatternConstraints( - const llvm::DenseSet &constraints) { + const llvm::ArrayRef constraints) { for (auto &leaf : constraints) { assert(leaf.isOperandMatcher() || leaf.isAttrMatcher()); collectConstraint( diff --git a/mlir/tools/mlir-tblgen/RewriterGen.cpp b/mlir/tools/mlir-tblgen/RewriterGen.cpp --- a/mlir/tools/mlir-tblgen/RewriterGen.cpp +++ b/mlir/tools/mlir-tblgen/RewriterGen.cpp @@ -322,7 +322,7 @@ int staticMatcherCounter = 0; // The DagLeaf which contains type or attr constraint. - DenseSet constraints; + SetVector constraints; // Static type/attribute verification function emitter. StaticVerifierFunctionEmitter staticVerifierEmitter; @@ -1713,7 +1713,7 @@ } void StaticMatcherHelper::populateStaticConstraintFunctions(raw_ostream &os) { - staticVerifierEmitter.emitPatternConstraints(constraints); + staticVerifierEmitter.emitPatternConstraints(constraints.getArrayRef()); } void StaticMatcherHelper::addPattern(Record *record) {