[llvm] [BOLT] Add support for safe-icf (PR #116275)
Maksim Panchenko via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 13 16:26:56 PST 2024
================
@@ -340,6 +355,77 @@ typedef std::unordered_map<BinaryFunction *, std::vector<BinaryFunction *>,
namespace llvm {
namespace bolt {
+void IdenticalCodeFolding::initVTableReferences(const BinaryContext &BC) {
+ initVtable();
+ for (const auto &[Address, Data] : BC.getBinaryData()) {
+ // Filter out all symbols that are not vtables.
+ if (!Data->getName().starts_with("_ZTV"))
+ continue;
+ for (uint64_t I = Address, End = I + Data->getSize(); I < End; I += 8)
+ setAddressUsedInVTable(I);
+ }
+}
----------------
maksfb wrote:
nit: insert empty lines between function definitions.
https://github.com/llvm/llvm-project/pull/116275
More information about the llvm-commits
mailing list