[llvm] [BOLT] Add support for safe-icf (PR #116275)
Maksim Panchenko via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 11 14:47:21 PST 2024
================
@@ -39,20 +39,29 @@ class IdenticalCodeFolding : public BinaryFunctionPass {
All, // Aggressive ICF for code.
};
explicit IdenticalCodeFolding(const cl::opt<bool> &PrintPass)
- : BinaryFunctionPass(PrintPass) {}
+ : BinaryFunctionPass(PrintPass) {
+ VtableBitVector.resize((((uint64_t)1) << 32) / 8);
+ }
const char *getName() const override { return "identical-code-folding"; }
Error runOnFunctions(BinaryContext &BC) override;
private:
+ /// Bit vector of memory addresses of vtables.
+ llvm::BitVector VtableBitVector;
+ bool isInVTable(uint64_t Address) const {
+ return VtableBitVector.test(Address / 8);
+ }
+ /// Scans symbol table and creates a bit vector of memory addresses of
+ /// vtables.
+ void processSymbolTable(const BinaryContext &BC);
----------------
maksfb wrote:
`initVTableReferences()`?
https://github.com/llvm/llvm-project/pull/116275
More information about the llvm-commits
mailing list