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("");