[llvm-branch-commits] [BOLT] Emit intra-function control flow in YAMLBAT (PR #76911)

Amir Ayupov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Mar 22 09:09:49 PDT 2024


================
@@ -128,6 +128,26 @@ class BoltAddressTranslation {
   /// Returns BB index by function output address (after BOLT) and basic block
   /// input offset.
   unsigned getBBIndex(uint64_t FuncOutputAddress, uint32_t BBInputOffset) const;
+
+  using BBHashMap = std::map<uint32_t, std::pair<unsigned, size_t>>;
+  /// Return a mapping from basic block input offset to hash and block index for a given function.
+  const BBHashMap &getBBHashMap(uint64_t OutputAddress) const {
+    return FuncHashes.at(OutputAddress).second;
----------------
aaupov wrote:

Thanks for pointing out. You're right, it does throw an exception: https://en.cppreference.com/w/cpp/container/map/at

I had code with `find` and `assert` but switched to `at` for conciseness. Let me unwind that.

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


More information about the llvm-branch-commits mailing list