Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions bolt/lib/Profile/DataAggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,11 +906,10 @@ DataAggregator::getFallthroughsInTrace(BinaryFunction &BF, const Trace &Trace,
if (BF.isPseudo())
return Branches;

if (!BF.isSimple())
// Can only record traces in CFG state
if (!BF.hasCFG())
return std::nullopt;

assert(BF.hasCFG() && "can only record traces in CFG state");

const BinaryBasicBlock *FromBB = BF.getBasicBlockContainingOffset(From);
const BinaryBasicBlock *ToBB = BF.getBasicBlockContainingOffset(To);

Expand Down
15 changes: 0 additions & 15 deletions bolt/lib/Rewrite/RewriteInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,21 +714,6 @@ Error RewriteInstance::run() {

preprocessProfileData();

// Skip disassembling if we have a translation table and we are running an
// aggregation job.
if (opts::AggregateOnly && BAT->enabledFor(InputFile)) {
// YAML profile in BAT mode requires CFG for .bolt.org.text functions
if (!opts::SaveProfile.empty() ||
opts::ProfileFormat == opts::ProfileFormatKind::PF_YAML) {
selectFunctionsToProcess();
disassembleFunctions();
processMetadataPreCFG();
buildFunctionsCFG();
}
processProfileData();
return Error::success();
}

selectFunctionsToProcess();

readDebugInfo();
Expand Down
18 changes: 16 additions & 2 deletions bolt/test/X86/unclaimed-jt-entries.s
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@

# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
# RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q

## Check that non-simple function profile is emitted in perf2bolt mode
# RUN: link_fdata %s %t.exe %t.pa PREAGG
# RUN: llvm-strip -N L5 -N L5_ret %t.exe
# RUN: perf2bolt %t.exe -p %t.pa --pa -o %t.fdata -strict=0 -print-profile \
# RUN: -print-only=main | FileCheck %s --check-prefix=CHECK-P2B
# CHECK-P2B: PERF2BOLT: traces mismatching disassembled function contents: 0
# CHECK-P2B: Binary Function "main"
# CHECK-P2B: IsSimple : 0
# RUN: FileCheck %s --input-file %t.fdata --check-prefix=CHECK-FDATA
# CHECK-FDATA: 1 main 0 1 main 7 0 1

# RUN: llvm-bolt %t.exe -v=1 -o %t.out 2>&1 | FileCheck %s

# CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in main
Expand All @@ -33,8 +45,10 @@
.size main, .Lend-main
main:
jmp *L4-24(,%rdi,8)
.L5:
# PREAGG: T #main# #L5# #L5_ret# 1
L5:
movl $4, %eax
L5_ret:
ret
.L9:
movl $2, %eax
Expand All @@ -58,7 +72,7 @@ L4:
.quad .L3
.quad .L6
.quad .L3
.quad .L5
.quad L5
.quad .L3
.quad .L3
.quad .L3
Expand Down
Loading