This is an archive of the discontinued LLVM Phabricator instance.

[libc] add sprintf size comparison
ClosedPublic

Authored by michaelrj on Aug 11 2022, 3:51 PM.

Details

Summary

To accurately measure the size of sprintf in a finished binary, the
easiest method is to simply build a binary with and without sprintf.
This patch adds an integration test that can be built with and without
sprintf, as well as targets to build it.

Diff Detail

Event Timeline

michaelrj created this revision.Aug 11 2022, 3:51 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 11 2022, 3:51 PM
michaelrj requested review of this revision.Aug 11 2022, 3:51 PM
sivachandra accepted this revision.Aug 12 2022, 12:06 AM

Good to go after absorbing https://reviews.llvm.org/D131752

libc/test/integration/src/stdio/CMakeLists.txt
5

Add a comment here saying that these are really not tests for testing sake but just a way to produce hermetic binaries to be used to compare binary sizes.

This revision is now accepted and ready to land.Aug 12 2022, 12:06 AM

remarks can tell you the number of instructions per function and stack sizes:

https://llvm.org/docs/Remarks.html

Remarks seems like a useful tool for future optimization, but here I'm trying to measure not just how many instructions and stack spaces the function takes up. I'm looking to evaluate the number of bytes adding sprintf will add to a file, including things like rodata and other overhead, and it doesn't look like remarks has a way to measure that easily.

michaelrj marked an inline comment as done.

rebase onto new memory function inclusion method

This revision was landed with ongoing or failed builds.Aug 12 2022, 11:47 AM
This revision was automatically updated to reflect the committed changes.