[llvm] [memprof] Introduce FrameIdConverter and CallStackIdConverter (PR #90307)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 19:01:01 PDT 2024


================
@@ -737,6 +737,64 @@ class CallStackLookupTrait {
 // Compute a CallStackId for a given call stack.
 CallStackId hashCallStack(ArrayRef<FrameId> CS);
 
+namespace detail {
+// "Dereference" the iterator from DenseMap or OnDiskChainedHashTable.  We have
+// to do so in one of two different ways depending on the type of the hash
+// table.
+template <typename value_type, typename IterTy>
+value_type DerefIterator(IterTy Iter) {
+  using deref_type = llvm::remove_cvref_t<decltype(*Iter)>;
+  if constexpr (std::is_same_v<deref_type, value_type>)
+    return *Iter;
+  else
+    return Iter->second;
+}
+} // namespace detail
+
+// A function object that returns a call stack for a given FrameId.
----------------
teresajohnson wrote:

"returns a Frame" ?

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


More information about the llvm-commits mailing list