[BOLT][NFC] Simplify doTrace in BAT mode (#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
This commit is contained in:
parent
227f759644
commit
6d8c6ef90c
@ -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;
|
||||
|
@ -835,13 +835,8 @@ bool DataAggregator::doTrace(const Trace &Trace, uint64_t Count,
|
||||
|
||||
LLVM_DEBUG(dbgs() << "Processing " << FTs->size() << " fallthroughs for "
|
||||
<< FromFunc->getPrintName() << ":" << Trace << '\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 (const auto &[From, To] : *FTs)
|
||||
doIntraBranch(*ParentFunc, From, To, Count, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user