This is an archive of the discontinued LLVM Phabricator instance.

[Profile] deprecate __llvm_profile_override_default_filename (part-1)
ClosedPublic

Authored by davidxl on Jul 20 2016, 11:26 PM.

Details

Summary

When non-default profile name is specified on command line, the current instrumentation needs to synthesize llvm_profile_init function and emits function call to llvm_profile_override_filename (in addition to creating a char array variable with private linkage to hold the name).

In fact, such calls are completely unnecessary. It is enough to promote the profile name var to global linkage in comdat (or weakany) and eliminate the call. The text size will be reduced, so will the readonly data size (duplicates gets commoned). The runtime start up time will also improve slightly.

Diff Detail

Event Timeline

davidxl updated this revision to Diff 64824.Jul 20 2016, 11:26 PM
davidxl retitled this revision from to [Profile] deprecate __llvm_profile_override_default_filename (part-1).
davidxl updated this object.
davidxl added a reviewer: vsk.
davidxl added a subscriber: llvm-commits.
vsk edited edge metadata.Jul 21 2016, 10:52 AM

Nice, just one concern.

lib/Transforms/Instrumentation/InstrProfiling.cpp
615

What's the advantage of placing the file name var in a comdat if it already has weak linkage? Would some ELF tests break without this?

vsk accepted this revision.Jul 21 2016, 2:06 PM
vsk edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Jul 21 2016, 2:06 PM
This revision was automatically updated to reflect the committed changes.