[llvm-branch-commits] [BOLT][NFC] Simplify doTrace in BAT mode (PR #143233)

2025-06-20 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/143233


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [BOLT][NFC] Simplify doTrace in BAT mode (PR #143233)

2025-06-20 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/143233


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [BOLT][NFC] Simplify doTrace in BAT mode (PR #143233)

2025-06-20 Thread Rafael Auler via llvm-branch-commits

https://github.com/rafaelauler approved this pull request.

lgtm

https://github.com/llvm/llvm-project/pull/143233
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [BOLT][NFC] Simplify doTrace in BAT mode (PR #143233)

2025-06-06 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-bolt

Author: Amir Ayupov (aaupov)


Changes

`BoltAddressTranslation::getFallthroughsInTrace` iterates over address
translation map entries and therefore has direct access to both original
and translated offsets. Return the translated offsets in fall-throughs
list to avoid duplicate address translation inside `doTrace`.

Test Plan: NFC


---
Full diff: https://github.com/llvm/llvm-project/pull/143233.diff


2 Files Affected:

- (modified) bolt/lib/Profile/BoltAddressTranslation.cpp (+2-2) 
- (modified) bolt/lib/Profile/DataAggregator.cpp (+1-6) 


``diff
diff --git a/bolt/lib/Profile/BoltAddressTranslation.cpp 
b/bolt/lib/Profile/BoltAddressTranslation.cpp
index a253522e4fb15..7ad4e6a2e1411 100644
--- a/bolt/lib/Profile/BoltAddressTranslation.cpp
+++ b/bolt/lib/Profile/BoltAddressTranslation.cpp
@@ -546,7 +546,7 @@ BoltAddressTranslation::getFallthroughsInTrace(uint64_t 
FuncAddress,
 return Res;
 
   for (auto Iter = FromIter; Iter != ToIter;) {
-const uint32_t Src = Iter->first;
+const uint32_t Src = Iter->second >> 1;
 if (Iter->second & BRANCHENTRY) {
   ++Iter;
   continue;
@@ -557,7 +557,7 @@ BoltAddressTranslation::getFallthroughsInTrace(uint64_t 
FuncAddress,
   ++Iter;
 if (Iter->second & BRANCHENTRY)
   break;
-Res.emplace_back(Src, Iter->first);
+Res.emplace_back(Src, Iter->second >> 1);
   }
 
   return Res;
diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index 752b00c7de4e8..52452a3bb0d46 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -827,13 +827,8 @@ bool DataAggregator::doTrace(const LBREntry &First, const 
LBREntry &Second,
 << FromFunc->getPrintName() << ":"
 << Twine::utohexstr(First.To) << " to "
 << Twine::utohexstr(Second.From) << ".\n");
-  for (auto [From, To] : *FTs) {
-if (BAT) {
-  From = BAT->translate(FromFunc->getAddress(), From, 
/*IsBranchSrc=*/true);
-  To = BAT->translate(FromFunc->getAddress(), To, /*IsBranchSrc=*/false);
-}
+  for (auto [From, To] : *FTs)
 doIntraBranch(*ParentFunc, From, To, Count, false);
-  }
 
   return true;
 }

``




https://github.com/llvm/llvm-project/pull/143233
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [BOLT][NFC] Simplify doTrace in BAT mode (PR #143233)

2025-06-06 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov ready_for_review 
https://github.com/llvm/llvm-project/pull/143233
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [BOLT][NFC] Simplify doTrace in BAT mode (PR #143233)

2025-06-06 Thread Amir Ayupov via llvm-branch-commits

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

`BoltAddressTranslation::getFallthroughsInTrace` iterates over address
translation map entries and therefore has direct access to both original
and translated offsets. Return the translated offsets in fall-throughs
list to avoid duplicate address translation inside `doTrace`.

Test Plan: NFC



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits