[llvm] [BOLT][NFC] Keep input icount for disassembled functions (PR #101091)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 29 15:24:29 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-bolt
Author: Amir Ayupov (aaupov)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/101091.diff
2 Files Affected:
- (modified) bolt/include/bolt/Core/BinaryFunction.h (+6)
- (modified) bolt/lib/Core/BinaryFunction.cpp (+2)
``````````diff
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("");
``````````
</details>
https://github.com/llvm/llvm-project/pull/101091
More information about the llvm-commits
mailing list