[llvm] [BOLT][NFC] Keep input icount for disassembled functions (PR #101091)
Amir Ayupov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 29 15:23:58 PDT 2024
https://github.com/aaupov created https://github.com/llvm/llvm-project/pull/101091
None
>From 588c0e28dcccc2f373d083c510a8a52d50bc419c Mon Sep 17 00:00:00 2001
From: Amir Ayupov <aaupov at fb.com>
Date: Mon, 29 Jul 2024 15:23:47 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.4
---
bolt/include/bolt/Core/BinaryFunction.h | 6 ++++++
bolt/lib/Core/BinaryFunction.cpp | 2 ++
2 files changed, 8 insertions(+)
diff --git a/bolt/include/bolt/Core/BinaryFunction.h b/bolt/include/bolt/Core/BinaryFunction.h
index 24c7db2f5d69c..2c8e23999b60c 100644
--- a/bolt/include/bolt/Core/BinaryFunction.h
+++ b/bolt/include/bolt/Core/BinaryFunction.h
@@ -242,6 +242,9 @@ class BinaryFunction {
/// Original size of the function.
uint64_t Size;
+ /// Original instruction count of the function, if disassembly succeeded.
+ uint64_t InputInstructionCount{0};
+
/// Address of the function in output.
uint64_t OutputAddress{0};
@@ -2173,6 +2176,9 @@ class BinaryFunction {
/// Get the number of instructions within this function.
uint64_t getInstructionCount() const;
+ /// Get the original number of instructions.
+ uint64_t getInputInstructionCount() const { return InputInstructionCount; }
+
const CFIInstrMapType &getFDEProgram() const { return FrameInstructions; }
void moveRememberRestorePair(BinaryBasicBlock *BB);
diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp
index ea09371b57e8a..1f5869cd0ab73 100644
--- a/bolt/lib/Core/BinaryFunction.cpp
+++ b/bolt/lib/Core/BinaryFunction.cpp
@@ -1499,6 +1499,8 @@ Error BinaryFunction::disassemble() {
clearList(Relocations);
+ InputInstructionCount = Instructions.size();
+
if (!IsSimple) {
clearList(Instructions);
return createNonFatalBOLTError("");
More information about the llvm-commits
mailing list