[llvm] [BOLT][NFC] Move BAT::fetchParentAddress to header (PR #93061)

Amir Ayupov via llvm-commits llvm-commits at lists.llvm.org
Wed May 22 09:05:56 PDT 2024


https://github.com/aaupov created https://github.com/llvm/llvm-project/pull/93061

Unbreak shared build after
https://github.com/llvm/llvm-project/pull/91683


>From 21b3377dc9c1bf6bdf02edbc49d268ccb9529893 Mon Sep 17 00:00:00 2001
From: Amir Ayupov <aaupov at fb.com>
Date: Wed, 22 May 2024 09:02:55 -0700
Subject: [PATCH] [BOLT][NFC] Move BAT::fetchParentAddress to header

Unbreak shared build after
https://github.com/llvm/llvm-project/pull/91683
---
 bolt/include/bolt/Profile/BoltAddressTranslation.h | 7 ++++++-
 bolt/lib/Profile/BoltAddressTranslation.cpp        | 7 -------
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/bolt/include/bolt/Profile/BoltAddressTranslation.h b/bolt/include/bolt/Profile/BoltAddressTranslation.h
index 68b993ee363cc..753310d910a7f 100644
--- a/bolt/include/bolt/Profile/BoltAddressTranslation.h
+++ b/bolt/include/bolt/Profile/BoltAddressTranslation.h
@@ -107,7 +107,12 @@ class BoltAddressTranslation {
 
   /// If available, fetch the address of the hot part linked to the cold part
   /// at \p Address. Return 0 otherwise.
-  uint64_t fetchParentAddress(uint64_t Address) const;
+  uint64_t fetchParentAddress(uint64_t Address) const {
+    auto Iter = ColdPartSource.find(Address);
+    if (Iter == ColdPartSource.end())
+      return 0;
+    return Iter->second;
+  }
 
   /// True if the input binary has a translation table we can use to convert
   /// addresses when aggregating profile
diff --git a/bolt/lib/Profile/BoltAddressTranslation.cpp b/bolt/lib/Profile/BoltAddressTranslation.cpp
index 7cfb9c132c2c6..8923bee07a310 100644
--- a/bolt/lib/Profile/BoltAddressTranslation.cpp
+++ b/bolt/lib/Profile/BoltAddressTranslation.cpp
@@ -547,13 +547,6 @@ BoltAddressTranslation::getFallthroughsInTrace(uint64_t FuncAddress,
   return Res;
 }
 
-uint64_t BoltAddressTranslation::fetchParentAddress(uint64_t Address) const {
-  auto Iter = ColdPartSource.find(Address);
-  if (Iter == ColdPartSource.end())
-    return 0;
-  return Iter->second;
-}
-
 bool BoltAddressTranslation::enabledFor(
     llvm::object::ELFObjectFileBase *InputFile) const {
   for (const SectionRef &Section : InputFile->sections()) {



More information about the llvm-commits mailing list