[clang] [clang-tools-extra] [llvm] [BOLT][NFC] Added double escape characters (PR #93348)

via cfe-commits cfe-commits at lists.llvm.org
Fri May 24 14:11:48 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tools-extra

Author: Sayhaan Siddiqui (sayhaan)

<details>
<summary>Changes</summary>

Added double escape characters to lines that describe a test.

>From [T187348734](https://www.internalfb.com/intern/tasks/?t=187348734)

---

Patch is 328.15 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/93348.diff


222 Files Affected:

- (modified) bolt/lib/Passes/ReorderFunctions.cpp (+139-156) 
- (modified) bolt/test/X86/addr32.s (+1-1) 
- (modified) bolt/test/X86/asm-dump.c (+1-1) 
- (modified) bolt/test/X86/asm-func-debug.test (+7-7) 
- (modified) bolt/test/X86/avx512-trap.test (+5-5) 
- (modified) bolt/test/X86/bb-with-two-tail-calls.s (+2-2) 
- (modified) bolt/test/X86/block-reordering.test (+2-3) 
- (modified) bolt/test/X86/bolt-address-translation-internal-call.test (+5-5) 
- (modified) bolt/test/X86/bolt-address-translation.test (+6-6) 
- (modified) bolt/test/X86/branch-data.test (+3-3) 
- (modified) bolt/test/X86/broken_dynsym.test (+3-3) 
- (modified) bolt/test/X86/bug-reorder-bb-jrcxz.s (+8-8) 
- (modified) bolt/test/X86/call-zero.s (+1-1) 
- (modified) bolt/test/X86/cfi-expr-rewrite.s (+2-2) 
- (modified) bolt/test/X86/cfi-instrs-count.s (+11-11) 
- (modified) bolt/test/X86/cfi-instrs-reordered.s (+2-2) 
- (modified) bolt/test/X86/ctc-and-unreachable.test (+2-2) 
- (modified) bolt/test/X86/debug-fission-single.s (+1-1) 
- (modified) bolt/test/X86/double-jump.test (+1-1) 
- (modified) bolt/test/X86/dwarf-handle-visit-loclist-error.s (+1-1) 
- (modified) bolt/test/X86/dwarf-test-df-logging.test (+1-1) 
- (modified) bolt/test/X86/dwarf3-lowpc-highpc-convert.s (+1-1) 
- (modified) bolt/test/X86/dwarf4-df-dualcu-loclist.test (+1-1) 
- (modified) bolt/test/X86/dwarf4-df-dualcu.test (+2-2) 
- (modified) bolt/test/X86/dwarf4-ftypes-dwo-input-dwp-output.test (+2-2) 
- (modified) bolt/test/X86/dwarf4-ftypes-dwp-input-dwo-output.test (+2-2) 
- (modified) bolt/test/X86/dwarf4-ftypes-dwp-input-dwp-output.test (+2-2) 
- (modified) bolt/test/X86/dwarf4-size-0-inlined_subroutine.s (+2-2) 
- (modified) bolt/test/X86/dwarf4-split-dwarf-no-address.test (+1-1) 
- (modified) bolt/test/X86/dwarf5-addr-section-reuse.s (+2-2) 
- (modified) bolt/test/X86/dwarf5-call-pc-function-null-check.test (+2-2) 
- (modified) bolt/test/X86/dwarf5-call-pc.test (+1-1) 
- (modified) bolt/test/X86/dwarf5-cu-no-debug-addr.test (+1-1) 
- (modified) bolt/test/X86/dwarf5-debug-info-dwarf4-debug-line.s (+1-1) 
- (modified) bolt/test/X86/dwarf5-debug-line.s (+1-1) 
- (modified) bolt/test/X86/dwarf5-debug-loclists.s (+1-1) 
- (modified) bolt/test/X86/dwarf5-df-dualcu-loclist.test (+1-1) 
- (modified) bolt/test/X86/dwarf5-df-dualcu.test (+2-2) 
- (modified) bolt/test/X86/dwarf5-df-mono-dualcu.test (+1-1) 
- (modified) bolt/test/X86/dwarf5-dwarf4-monolithic.test (+1-1) 
- (modified) bolt/test/X86/dwarf5-ftypes-dwp-input-dwo-output.test (+2-2) 
- (modified) bolt/test/X86/dwarf5-label-low-pc.s (+1-1) 
- (modified) bolt/test/X86/dwarf5-locaddrx.test (+2-2) 
- (modified) bolt/test/X86/dwarf5-locexpr-addrx.s (+2-2) 
- (modified) bolt/test/X86/dwarf5-loclist-offset-form.test (+1-1) 
- (modified) bolt/test/X86/dwarf5-lowpc-highpc-convert.s (+2-2) 
- (modified) bolt/test/X86/dwarf5-multiple-dw-op-addrx-locexpr.s (+1-1) 
- (modified) bolt/test/X86/dwarf5-rangeoffset-to-rangeindex.s (+1-1) 
- (modified) bolt/test/X86/dwarf5-return-pc-form-addr.test (+1-1) 
- (modified) bolt/test/X86/dwarf5-return-pc.test (+1-1) 
- (modified) bolt/test/X86/dwarf5-shared-str-offset-base.s (+2-2) 
- (modified) bolt/test/X86/dwarf5-split-dwarf4-monolithic.test (+3-3) 
- (modified) bolt/test/X86/dwarf5-two-loclists.test (+2-2) 
- (modified) bolt/test/X86/dwarf5-two-rnglists.test (+2-2) 
- (modified) bolt/test/X86/dynrelocs.s (+23-23) 
- (modified) bolt/test/X86/exceptions-args.test (+2-2) 
- (modified) bolt/test/X86/fallthrough-to-noop.test (+7-7) 
- (modified) bolt/test/X86/false-jump-table.s (+2-2) 
- (modified) bolt/test/X86/fragment-lite-reverse.s (+1-1) 
- (modified) bolt/test/X86/fragment-lite.s (+1-1) 
- (modified) bolt/test/X86/fragmented-symbols.s (+2-2) 
- (modified) bolt/test/X86/frame-opt-lea.s (+3-3) 
- (modified) bolt/test/X86/function-order-lite.s (+2-2) 
- (modified) bolt/test/X86/high_pc_udata.s (+2-2) 
- (modified) bolt/test/X86/icp-inline.s (+2-2) 
- (modified) bolt/test/X86/indirect-goto.test (+2-2) 
- (modified) bolt/test/X86/inlined-function-mixed.test (+2-2) 
- (modified) bolt/test/X86/insert-addr-rnglists_base.s (+2-2) 
- (modified) bolt/test/X86/insert-debug-info-entry.test (+1-1) 
- (modified) bolt/test/X86/internal-call-instrument-so.s (+1-1) 
- (modified) bolt/test/X86/internal-call-instrument.s (+1-1) 
- (modified) bolt/test/X86/interprocedural-ref-entry-point.s (+2-2) 
- (modified) bolt/test/X86/is-strip.s (+1-1) 
- (modified) bolt/test/X86/issue20.s (+3-3) 
- (modified) bolt/test/X86/issue20.test (+3-3) 
- (modified) bolt/test/X86/issue26.s (+3-3) 
- (modified) bolt/test/X86/issue26.test (+1-1) 
- (modified) bolt/test/X86/jmp-optimization.test (+1-1) 
- (modified) bolt/test/X86/jmpjmp.test (+2-2) 
- (modified) bolt/test/X86/jt-symbol-disambiguation-3.s (+10-10) 
- (modified) bolt/test/X86/jump-table-footprint-reduction.test (+2-2) 
- (modified) bolt/test/X86/jump-table-icp.test (+2-2) 
- (modified) bolt/test/X86/jump-table-pic-conflict.s (+16-16) 
- (modified) bolt/test/X86/jump-table-pic-order.test (+3-3) 
- (modified) bolt/test/X86/jump-table-reference.test (+1-1) 
- (modified) bolt/test/X86/layout-heuristic.test (+5-5) 
- (modified) bolt/test/X86/line-number.test (+6-6) 
- (modified) bolt/test/X86/loop-inversion-pass.s (+3-3) 
- (modified) bolt/test/X86/loop-nest.test (+1-1) 
- (modified) bolt/test/X86/merge-fdata-bat-mode.test (+2-4) 
- (modified) bolt/test/X86/merge-fdata-output.test (+2-2) 
- (modified) bolt/test/X86/no-entry-reordering.test (+2-2) 
- (modified) bolt/test/X86/no-output.test (+1-1) 
- (modified) bolt/test/X86/nolbr.s (+3-3) 
- (modified) bolt/test/X86/pre-aggregated-perf.test (+7-7) 
- (modified) bolt/test/X86/reader.test (+1-1) 
- (modified) bolt/test/X86/relaxed-tailcall.test (+1-1) 
- (modified) bolt/test/X86/remove-unused.test (+2-2) 
- (modified) bolt/test/X86/rodata-simpl-loads.test (+3-3) 
- (modified) bolt/test/X86/sctc-bug.test (+1-1) 
- (modified) bolt/test/X86/sctc-bug2.test (+1-1) 
- (modified) bolt/test/X86/sctc-bug3.test (+3-3) 
- (modified) bolt/test/X86/sctc-bug4.test (+1-1) 
- (modified) bolt/test/X86/shared_object_entry.s (+1-1) 
- (modified) bolt/test/X86/shorten-mov.test (+2-2) 
- (modified) bolt/test/X86/shrinkwrapping-and-rsp.s (+2-2) 
- (modified) bolt/test/X86/shrinkwrapping-critedge.s (+2-2) 
- (modified) bolt/test/X86/shrinkwrapping-do-not-pessimize.s (+13-13) 
- (modified) bolt/test/X86/shrinkwrapping-insertcfi.s (+2-2) 
- (modified) bolt/test/X86/shrinkwrapping-lea.s (+2-2) 
- (modified) bolt/test/X86/shrinkwrapping-mov.s (+3-3) 
- (modified) bolt/test/X86/shrinkwrapping-pop-order.s (+8-8) 
- (modified) bolt/test/X86/shrinkwrapping-popf.s (+2-2) 
- (modified) bolt/test/X86/shrinkwrapping-restore-position.s (+6-6) 
- (modified) bolt/test/X86/shrinkwrapping.test (+3-3) 
- (modified) bolt/test/X86/split-all-lptrampoline.s (+3-3) 
- (modified) bolt/test/X86/split-all.s (+1-1) 
- (modified) bolt/test/X86/split-func-icf.s (+4-4) 
- (modified) bolt/test/X86/split-func-jump-table-fragment-bidirection.s (+4-4) 
- (modified) bolt/test/X86/split-func-jump-table-fragment-noparent.s (+3-3) 
- (modified) bolt/test/X86/split-func-jump-table-fragment-reverse.s (+3-3) 
- (modified) bolt/test/X86/split-func-jump-table-fragment.s (+2-2) 
- (modified) bolt/test/X86/split-landing-pad.s (+9-9) 
- (modified) bolt/test/X86/split-random.s (+1-1) 
- (modified) bolt/test/X86/static-exe.test (+1-1) 
- (modified) bolt/test/X86/symtab-secondary-entries.test (+1-1) 
- (modified) bolt/test/X86/tail-duplication-cacheline.s (+2-2) 
- (modified) bolt/test/X86/tail-duplication-complex.s (+2-2) 
- (modified) bolt/test/X86/tail-duplication-jt.s (+2-2) 
- (modified) bolt/test/X86/tail-duplication-prop-bug.s (+1-1) 
- (modified) bolt/test/X86/tailcall-traps.test (+1-1) 
- (modified) bolt/test/X86/tailcall.test (+2-2) 
- (modified) bolt/test/X86/unclaimed-jt-entries.s (+2-2) 
- (modified) bolt/test/X86/unreachable.test (+1-1) 
- (modified) bolt/test/X86/vararg.test (+3-3) 
- (modified) bolt/test/X86/zero-sized-object.s (+2-2) 
- (modified) bolt/test/bad-exe.test (+2-2) 
- (modified) bolt/test/bolt-icf.test (+1-1) 
- (modified) bolt/test/bolt-info.test (+1-1) 
- (modified) bolt/test/heatmap.test (+1-1) 
- (modified) bolt/test/invalid-profile.test (+1-1) 
- (modified) bolt/test/keep-aranges.test (+2-2) 
- (modified) bolt/test/no-relocs.test (+1-1) 
- (modified) bolt/test/non-empty-debug-line.test (+4-4) 
- (modified) bolt/test/pie.test (+1-1) 
- (modified) bolt/test/re-optimize.test (+1-1) 
- (modified) bolt/test/shared-object.test (+1-1) 
- (modified) clang-tools-extra/clangd/unittests/FindTargetTests.cpp (+5-5) 
- (modified) clang/docs/ReleaseNotes.rst (-4) 
- (modified) clang/include/clang/AST/Stmt.h (+2-2) 
- (modified) clang/include/clang/Basic/DiagnosticDriverKinds.td (+5) 
- (modified) clang/include/clang/Basic/DiagnosticGroups.td (+3-1) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+9-1) 
- (modified) clang/include/clang/Basic/StmtNodes.td (+2-2) 
- (modified) clang/include/clang/Basic/TokenKinds.def (+1-1) 
- (modified) clang/include/clang/Driver/Options.td (+3-3) 
- (modified) clang/include/clang/Sema/Sema.h (+14-2) 
- (modified) clang/lib/AST/StmtPrinter.cpp (+1-1) 
- (modified) clang/lib/Driver/ToolChains/Clang.cpp (+7) 
- (modified) clang/lib/Sema/Sema.cpp (+1-1) 
- (modified) clang/lib/Sema/SemaCoroutine.cpp (+65-28) 
- (modified) clang/lib/Sema/SemaDeclCXX.cpp (+15) 
- (modified) clang/lib/Sema/TreeTransform.h (+2-1) 
- (modified) clang/test/AST/Inputs/std-coroutine-exp-namespace.h (+1-1) 
- (modified) clang/test/AST/Inputs/std-coroutine.h (+1-1) 
- (added) clang/test/AST/coroutine-locals-cleanup-exp-namespace.cpp (+109) 
- (added) clang/test/AST/coroutine-source-location-crash-exp-namespace.cpp (+43) 
- (modified) clang/test/CodeGen/no-skipped-passes-O0-opt-bisect.c (+2-2) 
- (added) clang/test/CodeGenCoroutines/coro-alloc-exp-namespace.cpp (+247) 
- (added) clang/test/CodeGenCoroutines/coro-always-inline-exp-namespace.cpp (+43) 
- (added) clang/test/CodeGenCoroutines/coro-await-domination-exp-namespace.cpp (+36) 
- (added) clang/test/CodeGenCoroutines/coro-await-exp-namespace.cpp (+355) 
- (added) clang/test/CodeGenCoroutines/coro-await-resume-eh-exp-namespace.cpp (+114) 
- (modified) clang/test/CodeGenCoroutines/coro-builtins-err.c (+1-1) 
- (modified) clang/test/CodeGenCoroutines/coro-builtins.c (+1-1) 
- (added) clang/test/CodeGenCoroutines/coro-cleanup-exp-namespace.cpp (+99) 
- (added) clang/test/CodeGenCoroutines/coro-dest-slot-exp-namespace.cpp (+40) 
- (added) clang/test/CodeGenCoroutines/coro-dwarf-exp-namespace.cpp (+72) 
- (added) clang/test/CodeGenCoroutines/coro-eh-cleanup-exp-namespace.cpp (+88) 
- (added) clang/test/CodeGenCoroutines/coro-gro-exp-namespace.cpp (+76) 
- (added) clang/test/CodeGenCoroutines/coro-gro2-exp-namespace.cpp (+81) 
- (modified) clang/test/CodeGenCoroutines/coro-gro2.cpp (+1-1) 
- (added) clang/test/CodeGenCoroutines/coro-lambda-exp-namespace.cpp (+61) 
- (added) clang/test/CodeGenCoroutines/coro-newpm-pipeline-exp-namespace.cpp (+45) 
- (added) clang/test/CodeGenCoroutines/coro-params-exp-namespace.cpp (+205) 
- (modified) clang/test/CodeGenCoroutines/coro-params.cpp (+2-1) 
- (added) clang/test/CodeGenCoroutines/coro-promise-dtor-exp-namespace.cpp (+38) 
- (added) clang/test/CodeGenCoroutines/coro-ret-void-exp-namespace.cpp (+53) 
- (added) clang/test/CodeGenCoroutines/coro-return-exp-namespace.cpp (+59) 
- (added) clang/test/CodeGenCoroutines/coro-return-voidtype-initlist-exp-namespace.cpp (+81) 
- (added) clang/test/CodeGenCoroutines/coro-symmetric-transfer-01-exp-namespace.cpp (+61) 
- (added) clang/test/CodeGenCoroutines/coro-symmetric-transfer-02-exp-namespace.cpp (+122) 
- (added) clang/test/CodeGenCoroutines/coro-unhandled-exception-exp-namespace.cpp (+76) 
- (added) clang/test/CodeGenCoroutines/microsoft-abi-operator-coawait-exp-namespace.cpp (+24) 
- (modified) clang/test/CoverageMapping/coroutine.cpp (+1-1) 
- (modified) clang/test/Driver/coroutines.c (+4-1) 
- (modified) clang/test/Driver/coroutines.cpp (+9-1) 
- (modified) clang/test/Index/coroutines.cpp (+1-1) 
- (modified) clang/test/Lexer/coroutines.cpp (+1-1) 
- (modified) clang/test/Lexer/cxx-features.cpp (+2-1) 
- (modified) clang/test/Modules/requires-coroutines.mm (+7) 
- (modified) clang/test/PCH/coroutines.cpp (+3-3) 
- (renamed) clang/test/Parser/cxx1z-coroutines.cpp (+2-2) 
- (added) clang/test/SemaCXX/Inputs/std-coroutine-exp-namespace.h (+35) 
- (added) clang/test/SemaCXX/co_await-range-for-exp-namespace.cpp (+165) 
- (added) clang/test/SemaCXX/coreturn-eh-exp-namespace.cpp (+47) 
- (added) clang/test/SemaCXX/coreturn-exp-namespace.cpp (+141) 
- (modified) clang/test/SemaCXX/coroutine-builtins.cpp (+1) 
- (added) clang/test/SemaCXX/coroutine-final-suspend-noexcept-exp-namespace.cpp (+106) 
- (added) clang/test/SemaCXX/coroutine-mixed-exp-namespace.cpp (+30) 
- (added) clang/test/SemaCXX/coroutine-mixed2-exp-namespace.cpp (+31) 
- (added) clang/test/SemaCXX/coroutine-mixed3-exp-namespace.cpp (+30) 
- (added) clang/test/SemaCXX/coroutine-mixed4-exp-namespace.cpp (+32) 
- (added) clang/test/SemaCXX/coroutine-rvo-exp-namespace.cpp (+149) 
- (added) clang/test/SemaCXX/coroutine-seh-exp-namespace.cpp (+40) 
- (added) clang/test/SemaCXX/coroutine-traits-undefined-template-exp-namespace.cpp (+20) 
- (added) clang/test/SemaCXX/coroutine-unhandled_exception-warning-exp-namespace.cpp (+42) 
- (added) clang/test/SemaCXX/coroutine-uninitialized-warning-crash-exp-namespace.cpp (+42) 
- (added) clang/test/SemaCXX/coroutine_handle-address-return-type-exp-namespace.cpp (+76) 
- (added) clang/test/SemaCXX/coroutines-exp-namespace.cpp (+1443) 
- (modified) clang/test/SemaCXX/thread-safety-coro.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/MachineOutliner.cpp (+6-2) 


``````````diff
diff --git a/bolt/lib/Passes/ReorderFunctions.cpp b/bolt/lib/Passes/ReorderFunctions.cpp
index 19ccf9f6fc80e..2715aea9eb6ad 100644
--- a/bolt/lib/Passes/ReorderFunctions.cpp
+++ b/bolt/lib/Passes/ReorderFunctions.cpp
@@ -29,82 +29,70 @@ extern cl::opt<uint32_t> RandomSeed;
 
 extern size_t padFunction(const bolt::BinaryFunction &Function);
 
-cl::opt<bolt::ReorderFunctions::ReorderType>
-ReorderFunctions("reorder-functions",
-  cl::desc("reorder and cluster functions (works only with relocations)"),
-  cl::init(bolt::ReorderFunctions::RT_NONE),
-  cl::values(clEnumValN(bolt::ReorderFunctions::RT_NONE,
-      "none",
-      "do not reorder functions"),
-    clEnumValN(bolt::ReorderFunctions::RT_EXEC_COUNT,
-      "exec-count",
-      "order by execution count"),
-    clEnumValN(bolt::ReorderFunctions::RT_HFSORT,
-      "hfsort",
-      "use hfsort algorithm"),
-    clEnumValN(bolt::ReorderFunctions::RT_HFSORT_PLUS,
-      "hfsort+",
-      "use hfsort+ algorithm"),
-    clEnumValN(bolt::ReorderFunctions::RT_PETTIS_HANSEN,
-      "pettis-hansen",
-      "use Pettis-Hansen algorithm"),
-    clEnumValN(bolt::ReorderFunctions::RT_RANDOM,
-      "random",
-      "reorder functions randomly"),
-    clEnumValN(bolt::ReorderFunctions::RT_USER,
-      "user",
-      "use function order specified by -function-order")),
-  cl::ZeroOrMore,
-  cl::cat(BoltOptCategory));
+cl::opt<bolt::ReorderFunctions::ReorderType> ReorderFunctions(
+    "reorder-functions",
+    cl::desc("reorder and cluster functions (works only with relocations)"),
+    cl::init(bolt::ReorderFunctions::RT_NONE),
+    cl::values(clEnumValN(bolt::ReorderFunctions::RT_NONE, "none",
+                          "do not reorder functions"),
+               clEnumValN(bolt::ReorderFunctions::RT_EXEC_COUNT, "exec-count",
+                          "order by execution count"),
+               clEnumValN(bolt::ReorderFunctions::RT_HFSORT, "hfsort",
+                          "use hfsort algorithm"),
+               clEnumValN(bolt::ReorderFunctions::RT_HFSORT_PLUS, "hfsort+",
+                          "use hfsort+ algorithm"),
+               clEnumValN(bolt::ReorderFunctions::RT_PETTIS_HANSEN,
+                          "pettis-hansen", "use Pettis-Hansen algorithm"),
+               clEnumValN(bolt::ReorderFunctions::RT_RANDOM, "random",
+                          "reorder functions randomly"),
+               clEnumValN(bolt::ReorderFunctions::RT_USER, "user",
+                          "use function order specified by -function-order")),
+    cl::ZeroOrMore, cl::cat(BoltOptCategory));
 
 static cl::opt<bool> ReorderFunctionsUseHotSize(
     "reorder-functions-use-hot-size",
     cl::desc("use a function's hot size when doing clustering"), cl::init(true),
     cl::cat(BoltOptCategory));
 
-static cl::opt<std::string>
-FunctionOrderFile("function-order",
-  cl::desc("file containing an ordered list of functions to use for function "
-           "reordering"),
-  cl::cat(BoltOptCategory));
+static cl::opt<std::string> FunctionOrderFile(
+    "function-order",
+    cl::desc("file containing an ordered list of functions to use for function "
+             "reordering"),
+    cl::cat(BoltOptCategory));
 
-static cl::opt<std::string>
-GenerateFunctionOrderFile("generate-function-order",
-  cl::desc("file to dump the ordered list of functions to use for function "
-           "reordering"),
-  cl::cat(BoltOptCategory));
+static cl::opt<std::string> GenerateFunctionOrderFile(
+    "generate-function-order",
+    cl::desc("file to dump the ordered list of functions to use for function "
+             "reordering"),
+    cl::cat(BoltOptCategory));
 
-static cl::opt<std::string>
-LinkSectionsFile("generate-link-sections",
-  cl::desc("generate a list of function sections in a format suitable for "
-           "inclusion in a linker script"),
-  cl::cat(BoltOptCategory));
+static cl::opt<std::string> LinkSectionsFile(
+    "generate-link-sections",
+    cl::desc("generate a list of function sections in a format suitable for "
+             "inclusion in a linker script"),
+    cl::cat(BoltOptCategory));
 
 static cl::opt<bool>
     UseEdgeCounts("use-edge-counts",
                   cl::desc("use edge count data when doing clustering"),
                   cl::init(true), cl::cat(BoltOptCategory));
 
-static cl::opt<bool>
-CgFromPerfData("cg-from-perf-data",
-  cl::desc("use perf data directly when constructing the call graph"
-           " for stale functions"),
-  cl::init(true),
-  cl::ZeroOrMore,
-  cl::cat(BoltOptCategory));
+static cl::opt<bool> CgFromPerfData(
+    "cg-from-perf-data",
+    cl::desc("use perf data directly when constructing the call graph"
+             " for stale functions"),
+    cl::init(true), cl::ZeroOrMore, cl::cat(BoltOptCategory));
 
 static cl::opt<bool> CgIgnoreRecursiveCalls(
     "cg-ignore-recursive-calls",
     cl::desc("ignore recursive calls when constructing the call graph"),
     cl::init(true), cl::cat(BoltOptCategory));
 
-static cl::opt<bool>
-CgUseSplitHotSize("cg-use-split-hot-size",
-  cl::desc("use hot/cold data on basic blocks to determine hot sizes for "
-           "call graph functions"),
-  cl::init(false),
-  cl::ZeroOrMore,
-  cl::cat(BoltOptCategory));
+static cl::opt<bool> CgUseSplitHotSize(
+    "cg-use-split-hot-size",
+    cl::desc("use hot/cold data on basic blocks to determine hot sizes for "
+             "call graph functions"),
+    cl::init(false), cl::ZeroOrMore, cl::cat(BoltOptCategory));
 
 } // namespace opts
 
@@ -157,13 +145,13 @@ void ReorderFunctions::printStats(const std::vector<Cluster> &Clusters,
   bool PrintDetailed = opts::Verbosity > 1;
 #ifndef NDEBUG
   PrintDetailed |=
-    (DebugFlag && isCurrentDebugType("hfsort") && opts::Verbosity > 0);
+      (DebugFlag && isCurrentDebugType("hfsort") && opts::Verbosity > 0);
 #endif
-  uint64_t TotalSize   = 0;
-  uint64_t CurPage     = 0;
-  uint64_t Hotfuncs    = 0;
+  uint64_t TotalSize = 0;
+  uint64_t CurPage = 0;
+  uint64_t Hotfuncs = 0;
   double TotalDistance = 0;
-  double TotalCalls    = 0;
+  double TotalCalls = 0;
   double TotalCalls64B = 0;
   double TotalCalls4KB = 0;
   double TotalCalls2MB = 0;
@@ -198,21 +186,22 @@ void ReorderFunctions::printStats(const std::vector<Cluster> &Clusters,
                    << "BOLT-INFO:   Src: " << *Cg.nodeIdToFunc(FuncId) << "\n"
                    << "BOLT-INFO:   Dst: " << *Cg.nodeIdToFunc(Dst) << "\n"
                    << "BOLT-INFO:   Weight = " << W << "\n"
-                   << "BOLT-INFO:   AvgOffset = " << Arc.avgCallOffset() << "\n";
+                   << "BOLT-INFO:   AvgOffset = " << Arc.avgCallOffset()
+                   << "\n";
           Calls += W;
-          if (D < 64)        TotalCalls64B += W;
-          if (D < 4096)      TotalCalls4KB += W;
-          if (D < (2 << 20)) TotalCalls2MB += W;
+          if (D < 64)
+            TotalCalls64B += W;
+          if (D < 4096)
+            TotalCalls4KB += W;
+          if (D < (2 << 20))
+            TotalCalls2MB += W;
           Dist += Arc.weight() * D;
           if (PrintDetailed)
             outs() << format("BOLT-INFO: arc: %u [@%lu+%.1lf] -> %u [@%lu]: "
                              "weight = %.0lf, callDist = %f\n",
-                             Arc.src(),
-                             FuncAddr[Arc.src()],
-                             Arc.avgCallOffset(),
-                             Arc.dst(),
-                             FuncAddr[Arc.dst()],
-                             Arc.weight(), D);
+                             Arc.src(), FuncAddr[Arc.src()],
+                             Arc.avgCallOffset(), Arc.dst(),
+                             FuncAddr[Arc.dst()], Arc.weight(), D);
         }
         TotalCalls += Calls;
         TotalDistance += Dist;
@@ -290,33 +279,30 @@ void ReorderFunctions::runOnFunctions(BinaryContext &BC) {
   switch (opts::ReorderFunctions) {
   case RT_NONE:
     break;
-  case RT_EXEC_COUNT:
-    {
-      std::vector<BinaryFunction *> SortedFunctions(BFs.size());
-      uint32_t Index = 0;
-      llvm::transform(llvm::make_second_range(BFs), SortedFunctions.begin(),
-                      [](BinaryFunction &BF) { return &BF; });
-      llvm::stable_sort(SortedFunctions, [&](const BinaryFunction *A,
-                                             const BinaryFunction *B) {
-        if (A->isIgnored())
+  case RT_EXEC_COUNT: {
+    std::vector<BinaryFunction *> SortedFunctions(BFs.size());
+    uint32_t Index = 0;
+    llvm::transform(llvm::make_second_range(BFs), SortedFunctions.begin(),
+                    [](BinaryFunction &BF) { return &BF; });
+    llvm::stable_sort(SortedFunctions, [&](const BinaryFunction *A,
+                                           const BinaryFunction *B) {
+      if (A->isIgnored())
+        return false;
+      const size_t PadA = opts::padFunction(*A);
+      const size_t PadB = opts::padFunction(*B);
+      if (!PadA || !PadB) {
+        if (PadA)
+          return true;
+        if (PadB)
           return false;
-        const size_t PadA = opts::padFunction(*A);
-        const size_t PadB = opts::padFunction(*B);
-        if (!PadA || !PadB) {
-          if (PadA)
-            return true;
-          if (PadB)
-            return false;
-        }
-        return !A->hasProfile() &&
-               (B->hasProfile() ||
-                (A->getExecutionCount() > B->getExecutionCount()));
-      });
-      for (BinaryFunction *BF : SortedFunctions)
-        if (BF->hasProfile())
-          BF->setIndex(Index++);
-    }
-    break;
+      }
+      return !A->hasProfile() && (B->hasProfile() || (A->getExecutionCount() >
+                                                      B->getExecutionCount()));
+    });
+    for (BinaryFunction *BF : SortedFunctions)
+      if (BF->hasProfile())
+        BF->setIndex(Index++);
+  } break;
   case RT_HFSORT:
     Clusters = clusterize(Cg);
     break;
@@ -330,74 +316,71 @@ void ReorderFunctions::runOnFunctions(BinaryContext &BC) {
     std::srand(opts::RandomSeed);
     Clusters = randomClusters(Cg);
     break;
-  case RT_USER:
-    {
-      // Build LTOCommonNameMap
-      StringMap<std::vector<uint64_t>> LTOCommonNameMap;
-      for (const BinaryFunction &BF : llvm::make_second_range(BFs))
-        for (StringRef Name : BF.getNames())
-          if (std::optional<StringRef> LTOCommonName = getLTOCommonName(Name))
-            LTOCommonNameMap[*LTOCommonName].push_back(BF.getAddress());
-
-      uint32_t Index = 0;
-      uint32_t InvalidEntries = 0;
-      for (const std::string &Function : readFunctionOrderFile()) {
-        std::vector<uint64_t> FuncAddrs;
-
-        BinaryData *BD = BC.getBinaryDataByName(Function);
-        if (!BD) {
-          // If we can't find the main symbol name, look for alternates.
-          uint32_t LocalID = 1;
-          while (true) {
-            const std::string FuncName =
-                Function + "/" + std::to_string(LocalID);
-            BD = BC.getBinaryDataByName(FuncName);
-            if (BD)
-              FuncAddrs.push_back(BD->getAddress());
-            else
-              break;
-            LocalID++;
-          }
-          // Strip LTO suffixes
-          if (std::optional<StringRef> CommonName = getLTOCommonName(Function))
-            if (LTOCommonNameMap.find(*CommonName) != LTOCommonNameMap.end())
-              llvm::append_range(FuncAddrs, LTOCommonNameMap[*CommonName]);
-        } else {
-          FuncAddrs.push_back(BD->getAddress());
+  case RT_USER: {
+    // Build LTOCommonNameMap
+    StringMap<std::vector<uint64_t>> LTOCommonNameMap;
+    for (const BinaryFunction &BF : llvm::make_second_range(BFs))
+      for (StringRef Name : BF.getNames())
+        if (std::optional<StringRef> LTOCommonName = getLTOCommonName(Name))
+          LTOCommonNameMap[*LTOCommonName].push_back(BF.getAddress());
+
+    uint32_t Index = 0;
+    uint32_t InvalidEntries = 0;
+    for (const std::string &Function : readFunctionOrderFile()) {
+      std::vector<uint64_t> FuncAddrs;
+
+      BinaryData *BD = BC.getBinaryDataByName(Function);
+      if (!BD) {
+        // If we can't find the main symbol name, look for alternates.
+        uint32_t LocalID = 1;
+        while (true) {
+          const std::string FuncName = Function + "/" + std::to_string(LocalID);
+          BD = BC.getBinaryDataByName(FuncName);
+          if (BD)
+            FuncAddrs.push_back(BD->getAddress());
+          else
+            break;
+          LocalID++;
         }
+        // Strip LTO suffixes
+        if (std::optional<StringRef> CommonName = getLTOCommonName(Function))
+          if (LTOCommonNameMap.find(*CommonName) != LTOCommonNameMap.end())
+            llvm::append_range(FuncAddrs, LTOCommonNameMap[*CommonName]);
+      } else {
+        FuncAddrs.push_back(BD->getAddress());
+      }
+
+      if (FuncAddrs.empty()) {
+        if (opts::Verbosity >= 1)
+          errs() << "BOLT-WARNING: Reorder functions: can't find function "
+                 << "for " << Function << "\n";
+        ++InvalidEntries;
+        continue;
+      }
 
-        if (FuncAddrs.empty()) {
+      for (const uint64_t FuncAddr : FuncAddrs) {
+        const BinaryData *FuncBD = BC.getBinaryDataAtAddress(FuncAddr);
+        assert(FuncBD);
+
+        BinaryFunction *BF = BC.getFunctionForSymbol(FuncBD->getSymbol());
+        if (!BF) {
           if (opts::Verbosity >= 1)
             errs() << "BOLT-WARNING: Reorder functions: can't find function "
                    << "for " << Function << "\n";
           ++InvalidEntries;
-          continue;
-        }
-
-        for (const uint64_t FuncAddr : FuncAddrs) {
-          const BinaryData *FuncBD = BC.getBinaryDataAtAddress(FuncAddr);
-          assert(FuncBD);
-
-          BinaryFunction *BF = BC.getFunctionForSymbol(FuncBD->getSymbol());
-          if (!BF) {
-            if (opts::Verbosity >= 1)
-              errs() << "BOLT-WARNING: Reorder functions: can't find function "
-                     << "for " << Function << "\n";
-            ++InvalidEntries;
-            break;
-          }
-          if (!BF->hasValidIndex())
-            BF->setIndex(Index++);
-          else if (opts::Verbosity > 0)
-            errs() << "BOLT-WARNING: Duplicate reorder entry for " << Function
-                   << "\n";
+          break;
         }
+        if (!BF->hasValidIndex())
+          BF->setIndex(Index++);
+        else if (opts::Verbosity > 0)
+          errs() << "BOLT-WARNING: Duplicate reorder entry for " << Function
+                 << "\n";
       }
-      if (InvalidEntries)
-        errs() << "BOLT-WARNING: Reorder functions: can't find functions for "
-               << InvalidEntries << " entries in -function-order list\n";
     }
-    break;
+    if (InvalidEntries)
+      errs() << "BOLT-WARNING: Reorder functions: can't find functions for "
+             << InvalidEntries << " entries in -function-order list\n";
+  } break;
   }
 
   reorder(std::move(Clusters), BFs);
diff --git a/bolt/test/X86/addr32.s b/bolt/test/X86/addr32.s
index 1f926c20c7ba8..03d6269031917 100644
--- a/bolt/test/X86/addr32.s
+++ b/bolt/test/X86/addr32.s
@@ -1,4 +1,4 @@
-# Check that we don't accidentally strip addr32 prefix
+## Check that we don't accidentally strip addr32 prefix
 
 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
 # RUN: ld.lld %t.o -o %t.exe -nostdlib
diff --git a/bolt/test/X86/asm-dump.c b/bolt/test/X86/asm-dump.c
index 5d85e2a0a151c..ce6f57df31ead 100644
--- a/bolt/test/X86/asm-dump.c
+++ b/bolt/test/X86/asm-dump.c
@@ -1,5 +1,5 @@
 /**
- * Test for asm-dump functionality.
+ ** Test for asm-dump functionality.
  *
  * REQUIRES: system-linux,bolt-runtime
  *
diff --git a/bolt/test/X86/asm-func-debug.test b/bolt/test/X86/asm-func-debug.test
index c690004b650b9..30d89878c4600 100644
--- a/bolt/test/X86/asm-func-debug.test
+++ b/bolt/test/X86/asm-func-debug.test
@@ -1,13 +1,13 @@
-# Verify that we update DW_TAG_compile_unit' ranges and .debug_aranges
-# for assembly function that doesn't have corresponding DIE.
-#
-# The input test case foo() contains nops that we remove.
+## Verify that we update DW_TAG_compile_unit' ranges and .debug_aranges
+## for assembly function that doesn't have corresponding DIE.
+##
+## The input test case foo() contains nops that we remove.
 
 RUN: %clang %cflags -gdwarf-5 -no-pie %p/../Inputs/asm_foo.s %p/../Inputs/asm_main.c -o %t.exe
 RUN: llvm-bolt %t.exe -o %t --update-debug-sections
 RUN: llvm-dwarfdump -all %t | FileCheck %s
 
-# Check ranges were created/updated for asm compile unit
+## Check ranges were created/updated for asm compile unit
 CHECK:       0x0000000c: DW_TAG_compile_unit
 CHECK-NEXT:       DW_AT_stmt_list (0x00000000)
 CHECK-NEXT:       DW_AT_low_pc (0x0000000000000000)
@@ -16,11 +16,11 @@ CHECK-NEXT:          [0x0000000000[[#%x,ADDR:]],
 CHECK-SAME:                              0x0000000000[[#ADDR+1]]))
 CHECK-NEXT:       DW_AT_name ("{{.*}}asm_foo.s")
 
-# Check .debug_aranges was updated for asm module
+## Check .debug_aranges was updated for asm module
 CHECK: .debug_aranges contents:
 CHECK-NEXT:   Address Range Header: length = 0x0000002c, format = DWARF32, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x08, seg_size = 0x00
 CHECK-NEXT:   [0x0000000000[[#ADDR]], 0x0000000000[[#ADDR+1]])
 
-# Check line number info was updated
+## Check line number info was updated
 CHECK:       0x0000000000[[#ADDR]]   13      0      0   0             0  is_stmt
 CHECK-NEXT:  0x0000000000[[#ADDR+1]] 13      0      0   0             0  is_stmt end_sequence
diff --git a/bolt/test/X86/avx512-trap.test b/bolt/test/X86/avx512-trap.test
index 68a0fbc8ff52c..93b02f4397cc8 100644
--- a/bolt/test/X86/avx512-trap.test
+++ b/bolt/test/X86/avx512-trap.test
@@ -1,5 +1,5 @@
-# Check that BOLT inserts trap instruction at entry to functions that use AVX-512.
-# Check that AVX-512 instruction is updated correctly when -trap-avx512=0 is passed.
+## Check that BOLT inserts trap instruction at entry to functions that use AVX-512.
+## Check that AVX-512 instruction is updated correctly when -trap-avx512=0 is passed.
 
 RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-unknown -o %t.o \
 RUN:   %S/Inputs/avx512.s
@@ -17,11 +17,11 @@ RUN:   FileCheck %s --check-prefix=CHECK-DIS-NO-TRAP
 
 CHECK: BOLT-WARNING: 1 function will trap on entry
 
-# Check that we have two ud2 instructions - one per entry.
+## Check that we have two ud2 instructions - one per entry.
 CHECK-DIS:      use_avx512
 CHECK-DIS-NEXT:    ud2
 CHECK-DIS-NEXT:    ud2
 
-# Check that we generate correct AVX-512
+## Check that we generate correct AVX-512
 CHECK-DIS-NO-TRAP:      use_avx512
-CHECK-DIS-NO-TRAP:          62 e2 f5 70 2c da    	vscalefpd 
+CHECK-DIS-NO-TRAP:          62 e2 f5 70 2c da    	vscalefpd
diff --git a/bolt/test/X86/bb-with-two-tail-calls.s b/bolt/test/X86/bb-with-two-tail-calls.s
index caad7b3d735f5..695b2ed772d97 100644
--- a/bolt/test/X86/bb-with-two-tail-calls.s
+++ b/bolt/test/X86/bb-with-two-tail-calls.s
@@ -1,5 +1,5 @@
-# This reproduces a bug with dynostats when trying to compute branch stats
-# at a block with two tails calls (one conditional and one unconditional).
+## This reproduces a bug with dynostats when trying to compute branch stats
+## at a block with two tails calls (one conditional and one unconditional).
 
 # REQUIRES: system-linux
 
diff --git a/bolt/test/X86/block-reordering.test b/bolt/test/X86/block-reordering.test
index a18a2109d37e2..7fae038610a4b 100644
--- a/bolt/test/X86/block-reordering.test
+++ b/bolt/test/X86/block-reordering.test
@@ -1,5 +1,5 @@
-# Tests whether llvm-bolt is able to reorder blocks and fix branches
-# according to the new function layout.
+## Tests whether llvm-bolt is able to reorder blocks and fix branches
+## according to the new function layout.
 
 RUN: yaml2obj %p/Inputs/blarge.yaml &> %t.exe
 RUN: llvm-bolt %t.exe -o /dev/null --data %p/Inputs/blarge.fdata \
@@ -46,4 +46,3 @@ CHECK:      Exec Count : 0
 CHECK:      Predecessors: .Ltmp{{.*}}
 CHECK:        {{.*}}:   movq    %rax, (%rsi)
 CHECK:        {{.*}}:   retq
-
diff --git a/bolt/test/X86/bolt-address-translation-internal-call.test b/bolt/test/X86/bolt-address-translation-internal-call.test
index edc32d966b3c9..9e9b388b9b5de 100644
--- a/bolt/test/X86/bolt-address-translation-internal-call.test
+++ b/bolt/test/X86/bolt-address-translation-internal-call.test
@@ -1,8 +1,8 @@
-# This checks ...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/93348


More information about the cfe-commits mailing list