diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp index 8385551576098..ff5eb5cf6e1eb 100644 --- a/bolt/lib/Core/BinaryFunction.cpp +++ b/bolt/lib/Core/BinaryFunction.cpp @@ -15,6 +15,7 @@ #include "bolt/Core/DynoStats.h" #include "bolt/Core/HashUtilities.h" #include "bolt/Core/MCPlusBuilder.h" +#include "bolt/Utils/CommandLineOpts.h" #include "bolt/Utils/NameResolver.h" #include "bolt/Utils/NameShortener.h" #include "bolt/Utils/Utils.h" @@ -1753,8 +1754,8 @@ void BinaryFunction::postProcessEntryPoints() { // In non-relocation mode there's potentially an external undetectable // reference to the entry point and hence we cannot move this entry // point. Optimizing without moving could be difficult. - // In BAT mode, register any known entry points for CFG construction. - if (!BC.HasRelocations && !BC.HasBATSection) + // In aggregation, register any known entry points for CFG construction. + if (!BC.HasRelocations && !opts::AggregateOnly) setSimple(false); const uint32_t Offset = KV.first; diff --git a/bolt/test/X86/entry-point-fallthru.s b/bolt/test/X86/entry-point-fallthru.s new file mode 100644 index 0000000000000..edf14247b0c43 --- /dev/null +++ b/bolt/test/X86/entry-point-fallthru.s @@ -0,0 +1,24 @@ +## Checks that fallthroughs spanning entry points are accepted in aggregation +## mode. + +# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o +# RUN: ld.lld %t.o -o %t +# RUN: link_fdata %s %t %t.preagg PREAGG +# RUN: perf2bolt %t -p %t.preagg --pa -o %t.fdata | FileCheck %s +# CHECK: traces mismatching disassembled function contents: 0 + + .globl main +main: + .cfi_startproc + vmovaps %zmm31,%zmm3 + +next: + add $0x4,%r9 + add $0x40,%r10 + dec %r14 +Ljmp: + jne main +# PREAGG: T #Ljmp# #main# #Ljmp# 1 + ret + .cfi_endproc +.size main,.-main