[llvm] [CGData][MachineOutliner] Global Outlining (PR #90074)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 12:05:35 PDT 2024


================
@@ -585,6 +644,107 @@ void MachineOutliner::emitOutlinedFunctionRemark(OutlinedFunction &OF) {
   MORE.emit(R);
 }
 
+struct MatchedEntry {
+  size_t StartIdx;
+  size_t Length;
+  size_t Count;
+};
+
+static const HashNode *followHashNode(stable_hash StableHash,
+                                      const HashNode *Current) {
+  auto I = Current->Successors.find(StableHash);
+  return (I == Current->Successors.end()) ? nullptr : I->second.get();
+}
+
+// Find all matches in the global outlined hash tree.
+// It's quadratic complexity in theory, but it's nearly linear in practice
+// since the length of outlined sequences are small within a block.
+static std::vector<MatchedEntry> getMatchedEntries(InstructionMapper &Mapper) {
----------------
ellishg wrote:

>From the comment it seems like this vector should be a `SmallVector<>`.

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


More information about the llvm-commits mailing list