This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho][nfc] Add `final` to classes where possible
ClosedPublic

Authored by int3 on Jun 13 2021, 10:55 AM.

Details

Reviewers
gkm
MaskRay
Group Reviewers
Restricted Project
Commits
rGda24e6d43e3f: [lld-macho][nfc] Add `final` to classes where possible
Summary

I wanted to see if we would get any perf wins out of this, but
it doesn't seem to be the case. But it still seems worth committing.

Diff Detail

Event Timeline

int3 created this revision.Jun 13 2021, 10:55 AM
Herald added a project: Restricted Project. · View Herald Transcript
int3 requested review of this revision.Jun 13 2021, 10:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 13 2021, 10:55 AM
MaskRay accepted this revision as: MaskRay.Jun 13 2021, 11:03 AM
MaskRay added a subscriber: MaskRay.

There may be size benefit due to devirtualization without LTO.

This revision is now accepted and ready to land.Jun 13 2021, 11:03 AM
This revision was landed with ongoing or failed builds.Jun 13 2021, 4:52 PM
This revision was automatically updated to reflect the committed changes.

I did this (for LibreOffice), and final seems to be only a win when we do LTO and we can de-virtualise a bunch of stuff.

I was hoping that final would also help for dynamic_cast (where, in theory, if we're casting to a final type, we can optimise to a simple comparison), but that doesn't seem to be impemented by the dynamic_cast machinery (or the compiler)