This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho][nfc] Factor out findSymbolAtOffset
ClosedPublic

Authored by int3 on Apr 7 2022, 5:37 AM.

Details

Reviewers
thakis
Group Reviewers
Restricted Project
Commits
rGda6b6b3c8201: [lld-macho][nfc] Factor out findSymbolAtOffset
Summary

Our compact unwind handling code currently has some logic to locate a
symbol at a given offset in an InputSection. The EH frame code will need
to do something similar, so let's factor out the code.

Diff Detail

Event Timeline

int3 created this revision.Apr 7 2022, 5:37 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 7 2022, 5:37 AM
int3 requested review of this revision.Apr 7 2022, 5:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2022, 5:37 AM
thakis accepted this revision.Apr 7 2022, 5:55 AM
thakis added a subscriber: thakis.

Do you see a speedup from the microoptimization in some other benchmark? If not, omit it (?)

lld/MachO/InputFiles.cpp
1020

Previously we advanced it instead of doing it = isec->relocs.erase(it) if nothing was found. The rhs doesn't do that. Is that intentional?

This revision is now accepted and ready to land.Apr 7 2022, 5:55 AM
int3 added a comment.Apr 7 2022, 6:04 AM

Yeah I don't see any benchmark improvement... I guess it's not worth the additional code complexity

lld/MachO/InputFiles.cpp
1020

oops, good catch

int3 marked an inline comment as done.Apr 7 2022, 6:11 AM
int3 added inline comments.
lld/MachO/InputFiles.cpp
1020

I think erasing it might actually make more sense, but I'll revisit this in a future diff. this one is supposed to be a NFC

int3 updated this revision to Diff 421180.Apr 7 2022, 6:11 AM

address comments

int3 retitled this revision from [lld-macho][nfc] Factor out & micro-optimize findSymbolAtOffset to [lld-macho][nfc] Factor out findSymbolAtOffset.Apr 7 2022, 6:12 AM
int3 edited the summary of this revision. (Show Details)
This revision was landed with ongoing or failed builds.Apr 7 2022, 6:13 AM
This revision was automatically updated to reflect the committed changes.