[PATCH] D127464: [BOLT] Mark fragments related to split jump table as non-simple

Huan Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 13:40:23 PDT 2022


nhuhuan updated this revision to Diff 436033.
nhuhuan added a comment.

Move the propagation of hasSplitJumpTable out of the lambda.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127464/new/

https://reviews.llvm.org/D127464

Files:
  bolt/lib/Core/BinaryContext.cpp
  bolt/lib/Rewrite/RewriteInstance.cpp
  bolt/test/X86/split-func-icf.s


Index: bolt/test/X86/split-func-icf.s
===================================================================
--- bolt/test/X86/split-func-icf.s
+++ 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
Index: bolt/lib/Rewrite/RewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/RewriteInstance.cpp
+++ bolt/lib/Rewrite/RewriteInstance.cpp
@@ -2923,7 +2923,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;
     }
Index: bolt/lib/Core/BinaryContext.cpp
===================================================================
--- bolt/lib/Core/BinaryContext.cpp
+++ bolt/lib/Core/BinaryContext.cpp
@@ -712,13 +712,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();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127464.436033.patch
Type: text/x-patch
Size: 2671 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220610/16f4f25b/attachment.bin>


More information about the llvm-commits mailing list