[llvm] [BOLT] Add support for safe-icf (PR #116275)
Amir Ayupov via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 13 16:07:09 PST 2024
================
@@ -366,43 +367,43 @@ void IdenticalCodeFolding::initVTableReferences(const BinaryContext &BC) {
}
void IdenticalCodeFolding::analyzeDataRelocations(BinaryContext &BC) {
initVTableReferences(BC);
+ // For static relocations there should be a symbol for function references.
for (const BinarySection &Sec : BC.sections()) {
if (!Sec.hasSectionRef() || !Sec.isData())
continue;
for (const auto &Rel : Sec.relocations()) {
const uint64_t RelAddr = Rel.Offset + Sec.getAddress();
if (isAddressInVTable(RelAddr))
continue;
- BinaryFunction *BF = BC.getFunctionForSymbol(Rel.Symbol);
- if (!BF)
- continue;
- BF->setHasAddressTaken(true);
+ if (BinaryFunction *BF = BC.getFunctionForSymbol(Rel.Symbol))
+ BF->setHasAddressTaken(true);
}
+ // For dyanmic relocations there are two cases:
----------------
aaupov wrote:
```suggestion
// For dynamic relocations there are two cases:
```
https://github.com/llvm/llvm-project/pull/116275
More information about the llvm-commits
mailing list