From: Benjamin Kramer Date: Thu, 17 Mar 2022 19:13:52 +0000 (+0100) Subject: [mlir] Move InterfaceMap::InterfaceMap to the cpp file X-Git-Tag: upstream/15.0.7~13222 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=548757ba86f60ceb62ea465c3f4f9b9c0c42b89f;p=platform%2Fupstream%2Fllvm.git [mlir] Move InterfaceMap::InterfaceMap to the cpp file So we don't end up with a copy of std::sort in every dialect definition. NFCI. --- diff --git a/mlir/include/mlir/Support/InterfaceSupport.h b/mlir/include/mlir/Support/InterfaceSupport.h index 53caebcaee69..e0f5dd39305b 100644 --- a/mlir/include/mlir/Support/InterfaceSupport.h +++ b/mlir/include/mlir/Support/InterfaceSupport.h @@ -220,12 +220,7 @@ public: /// Create an InterfaceMap given with the implementation of the interfaces. /// The use of this constructor is in general discouraged in favor of /// 'InterfaceMap::get()'. - InterfaceMap(MutableArrayRef> elements) - : interfaces(elements.begin(), elements.end()) { - llvm::sort(interfaces, [](const auto &lhs, const auto &rhs) { - return compare(lhs.first, rhs.first); - }); - } + InterfaceMap(MutableArrayRef> elements); /// Insert the given models as implementations of the corresponding interfaces /// for the concrete attribute class. diff --git a/mlir/lib/Support/InterfaceSupport.cpp b/mlir/lib/Support/InterfaceSupport.cpp index 5287dd0fe449..4b8dd58801e2 100644 --- a/mlir/lib/Support/InterfaceSupport.cpp +++ b/mlir/lib/Support/InterfaceSupport.cpp @@ -18,6 +18,14 @@ using namespace mlir; +detail::InterfaceMap::InterfaceMap( + MutableArrayRef> elements) + : interfaces(elements.begin(), elements.end()) { + llvm::sort(interfaces, [](const auto &lhs, const auto &rhs) { + return compare(lhs.first, rhs.first); + }); +} + void detail::InterfaceMap::insert( ArrayRef> elements) { // Insert directly into the right position to keep the interfaces sorted.