[llvm-branch-commits] [DO_NOT_MERGE][ELF] Add statistics for CFI jump table relaxation (PR #222530)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Sep 10 00:19:21 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lld
Author: Vitaly Buka (vitalybuka)
<details>
<summary>Changes</summary>
Add NumCfiJumpTablesInlined and NumCfiJumpTablesAdjustedLast statistics
to track the number of CFI jump table functions inlined and last entries
adjusted during relaxation.
---
Full diff: https://github.com/llvm/llvm-project/pull/222530.diff
1 Files Affected:
- (modified) lld/ELF/Arch/X86_64.cpp (+10)
``````````diff
diff --git a/lld/ELF/Arch/X86_64.cpp b/lld/ELF/Arch/X86_64.cpp
index f095f3622cb85..8b3b04b81c1b3 100644
--- a/lld/ELF/Arch/X86_64.cpp
+++ b/lld/ELF/Arch/X86_64.cpp
@@ -13,10 +13,18 @@
#include "SyntheticSections.h"
#include "Target.h"
#include "TargetImpl.h"
+#include "llvm/ADT/Statistic.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/MathExtras.h"
+#define DEBUG_TYPE "lld"
+
+STATISTIC(NumCfiJumpTablesInlined,
+ "Number of CFI jump table functions inlined");
+STATISTIC(NumCfiJumpTablesAdjustedLast,
+ "Number of CFI jump table last entries adjusted");
+
using namespace llvm;
using namespace llvm::object;
using namespace llvm::support::endian;
@@ -457,6 +465,7 @@ void X86_64::relaxCFIJumpTables() const {
target && target->size != 0 && target->size <= sec->entsize &&
target->addralign <= sec->entsize &&
target->getParent() == targetOutputSec) {
+ ++NumCfiJumpTablesInlined;
// Okay, we found a small enough section. Move it into the jump
// table. First add a slice for the unmodified jump table entries
// before this one. This slice may be of zero size if two
@@ -482,6 +491,7 @@ void X86_64::relaxCFIJumpTables() const {
// function's body acts as the last jump table entry), otherwise leave the
// jump table where it is and keep the last entry.
if (lastSec) {
+ ++NumCfiJumpTablesAdjustedLast;
addSectionSlice(begin, cur, rbegin, rcur);
replacements.push_back(lastSec);
sectionReplacements[sec] = {};
``````````
</details>
https://github.com/llvm/llvm-project/pull/222530
More information about the llvm-branch-commits
mailing list