[Mlir-commits] [mlir] [MLIR] Make the verification order fixed in DynamicOpTraitList (PR #180758)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Feb 10 07:51:23 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-core

Author: Twice (PragmaTwice)

<details>
<summary>Changes</summary>

Currently we use `DenseMap` in `DynamicOpTraitList` to store traits and iterate over the `DenseMap`, and we found that the order is not fixed and we also cannot control verification order.

In this PR we use `MapVector` to preserve the insertion order so that the verification order over traits can be fixed and users can tune the verification order.

---
Full diff: https://github.com/llvm/llvm-project/pull/180758.diff


1 Files Affected:

- (modified) mlir/include/mlir/IR/ExtensibleDialect.h (+1-1) 


``````````diff
diff --git a/mlir/include/mlir/IR/ExtensibleDialect.h b/mlir/include/mlir/IR/ExtensibleDialect.h
index 1021bd870d809..e52306f79378a 100644
--- a/mlir/include/mlir/IR/ExtensibleDialect.h
+++ b/mlir/include/mlir/IR/ExtensibleDialect.h
@@ -395,7 +395,7 @@ class DynamicOpTraitList {
   }
 
 private:
-  DenseMap<TypeID, std::unique_ptr<DynamicOpTrait>> traits;
+  llvm::MapVector<TypeID, std::unique_ptr<DynamicOpTrait>> traits;
 };
 
 template <template <typename T> class Trait>

``````````

</details>


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


More information about the Mlir-commits mailing list