mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 19:56:38 +00:00
[BOLT][BAT] Add support for three-way split functions (#93760)
In three-way split functions, if only .warm fragment is present, BAT incorrectly overwrites the map for .warm fragment by empty .cold fragment. Test Plan: updated register-fragments-bolt-symbols.s
This commit is contained in:
parent
045e68f97b
commit
dc1da93958
@ -129,6 +129,9 @@ void BoltAddressTranslation::write(const BinaryContext &BC, raw_ostream &OS) {
|
||||
LLVM_DEBUG(dbgs() << " Cold part\n");
|
||||
for (const FunctionFragment &FF :
|
||||
Function.getLayout().getSplitFragments()) {
|
||||
// Skip empty fragments to avoid adding zero-address entries to maps.
|
||||
if (FF.empty())
|
||||
continue;
|
||||
ColdPartSource.emplace(FF.getAddress(), Function.getOutputAddress());
|
||||
Map.clear();
|
||||
for (const BinaryBasicBlock *const BB : FF)
|
||||
|
@ -13,8 +13,12 @@
|
||||
# PREAGGWARM: B X:0 #chain.warm# 1 0
|
||||
# RUN: perf2bolt %t.warm.bolt -p %t.preagg.warm --pa -o %t.warm.fdata -w %t.warm.yaml \
|
||||
# RUN: -v=1 | FileCheck %s --check-prefix=CHECK-BOLT-WARM
|
||||
# RUN: FileCheck %s --input-file %t.warm.fdata --check-prefix=CHECK-FDATA-WARM
|
||||
# RUN: FileCheck %s --input-file %t.warm.yaml --check-prefix=CHECK-YAML-WARM
|
||||
|
||||
# CHECK-BOLT-WARM: marking chain.warm/1(*2) as a fragment of chain
|
||||
# CHECK-FDATA-WARM: chain
|
||||
# CHECK-YAML-WARM: chain
|
||||
|
||||
# RUN: sed -i 's|chain|chain/2|g' %t.fdata
|
||||
# RUN: llvm-objcopy --localize-symbol=chain %t.main.o
|
||||
|
Loading…
x
Reference in New Issue
Block a user