diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp --- a/bolt/lib/Core/BinaryContext.cpp +++ b/bolt/lib/Core/BinaryContext.cpp @@ -715,13 +715,15 @@ "internal error in traversing function fragments"); if (opts::Verbosity >= 1) errs() << "BOLT-WARNING: Ignoring " << BF->getPrintName() << '\n'; - BF->setIgnored(); + BF->setSimple(false); + BF->setHasSplitJumpTable(true); + std::for_each(BF->Fragments.begin(), BF->Fragments.end(), addToWorklist); std::for_each(BF->ParentFragments.begin(), BF->ParentFragments.end(), addToWorklist); } if (!FragmentsToSkip.empty()) - errs() << "BOLT-WARNING: ignored " << FragmentsToSkip.size() << " function" + errs() << "BOLT-WARNING: skipped " << FragmentsToSkip.size() << " function" << (FragmentsToSkip.size() == 1 ? "" : "s") << " due to cold fragments\n"; FragmentsToSkip.clear(); diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -2925,7 +2925,8 @@ continue; if (!Function.isSimple()) { - assert((!BC->HasRelocations || Function.getSize() == 0) && + assert((!BC->HasRelocations || Function.getSize() == 0 || + Function.hasSplitJumpTable()) && "unexpected non-simple function in relocation mode"); continue; } diff --git a/bolt/test/X86/split-func-icf.s b/bolt/test/X86/split-func-icf.s --- a/bolt/test/X86/split-func-icf.s +++ b/bolt/test/X86/split-func-icf.s @@ -8,15 +8,17 @@ # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o # RUN: llvm-strip --strip-unneeded %t.o # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -# RUN: llvm-bolt %t.exe -o %t.out -lite=0 -v=1 2>&1 | FileCheck %s +# RUN: llvm-bolt %t.exe -o %t.out -v=1 --print-only=main2.cold.1 --print-disasm 2>&1 | FileCheck %s # CHECK-NOT: unclaimed PC-relative relocations left in data # CHECK-DAG: BOLT-INFO: marking main2.cold.1(*2) as a fragment of main # CHECK-DAG: BOLT-INFO: marking main2.cold.1(*2) as a fragment of main2 +# CHECK: Binary Function "main2.cold.1(*2)" after disassembly +# CHECK: End of Function "main2.cold.1(*2)" # CHECK-DAG: BOLT-WARNING: Ignoring main2 # CHECK-DAG: BOLT-WARNING: Ignoring main # CHECK-DAG: BOLT-WARNING: Ignoring main2.cold.1(*2) -# CHECK: BOLT-WARNING: ignored 3 functions due to cold fragments +# CHECK: BOLT-WARNING: skipped 3 functions due to cold fragments .text .globl main .type main, %function