[llvm] [CGData] Outlined Hash Tree (PR #89792)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Fri May 3 12:38:43 PDT 2024


================
@@ -0,0 +1,131 @@
+//===-- OutlinedHashTree.cpp ----------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// An OutlinedHashTree is a Trie that contains sequences of stable hash values
+// of instructions that have been outlined. This OutlinedHashTree can be used
+// to understand the outlined instruction sequences collected across modules.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/CodeGenData/OutlinedHashTree.h"
+
+#include <stack>
+#include <tuple>
+
+#define DEBUG_TYPE "outlined-hash-tree"
+
+using namespace llvm;
+
+void OutlinedHashTree::walkGraph(NodeCallbackFn CallbackNode,
+                                 EdgeCallbackFn CallbackEdge,
+                                 bool SortedWalk) const {
+  std::stack<const HashNode *> Stack;
----------------
ellishg wrote:

I think we can just use a `SmallVector` here since it has [`pop_back_val()`](https://llvm.org/doxygen/classllvm_1_1SmallVectorImpl.html#a0c8ffe664a36e30d49c84d0aded2fe08) and [`emplace_back()`](https://llvm.org/doxygen/classllvm_1_1SmallVectorImpl.html#a396fcfee6914c76974b73c3d203da6a5).

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


More information about the llvm-commits mailing list