This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objcopy] Aggressively remove templates to decrease code size
AbandonedPublic

Authored by jakehehrlich on Dec 7 2017, 7:10 PM.

Details

Reviewers
jhenderson
Summary

Prioir to supporting all 4 ELF formats the fully optimized LTO llvm-objcopy was 650 KB, afterwards it was 3.5 MB. This size increase was an issue for Chromium people who plan on shipping llvm-objcopy as part of the chromium toolchain (why this size issue exists is still a mystery to me). This change splits several classes into template and non template parts so that as little identical code is reproduced as possible. I measure the size afterwards to be 774 KB which is hardly bigger than 650 KB. Going forward this pattern should be followed to minimize the size increase we experience overtime.

Diff Detail

Repository
rL LLVM

Event Timeline

jakehehrlich created this revision.Dec 7 2017, 7:10 PM
jakehehrlich abandoned this revision.Dec 8 2017, 4:38 PM

This was caused by a difference between dynamic and static linking. This change only reduces the binary size by about 100 KB.

jhenderson edited edge metadata.Dec 11 2017, 1:53 AM

This was caused by a difference between dynamic and static linking. This change only reduces the binary size by about 100 KB.

I'm glad that was the case, as I'm not sure I liked many of the changes this required!