[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:50:44 PST 2026


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

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.

>From 87d15a07631cf5c3b72adac761445fa11636cf61 Mon Sep 17 00:00:00 2001
From: PragmaTwice <twice at apache.org>
Date: Tue, 10 Feb 2026 23:47:36 +0800
Subject: [PATCH] [MLIR] Make the verification order fixed in
 DynamicOpTraitList

---
 mlir/include/mlir/IR/ExtensibleDialect.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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>



More information about the Mlir-commits mailing list