[PATCH] Initial instrumentation based PGO implementation

Justin Bogner mail at justinbogner.com
Sun Dec 1 20:15:09 PST 2013

Hey list,

Attached are the initial patches for instrumentation based PGO. The
first two are for clang, and the third for compiler-rt. 

This is an implementation of Bob's proposal from back in September. Most
of the design can be read about here:


I changed the flags to -fprofile-instr-use and -fprofile-instr-generate
to match the style of Diego's sampling based PGO flag. I'm open to other
suggestions, but do note that using -fprofile-generate introduces a bit
of an awkward conflict with the GCC-like GCDA profiling that is also
present in LLVM, since that's the flag GCC uses.

There are a few things that obviously still need work, but I think this
is a pretty reasonable incremental step. Notably:

- The data format is inefficent plain text that isn't even particularly
  easily understood by a human.
- The compiler-rt support is fairly limited, and there's no way to
  specify or change the profile data output file name.
- Objective C is basically completely ignored.
- The counters aren't scaled, so if they're greater than 32 bits they'll
  just be truncated.
- The code coverage aspect isn't included in this patch, but the
  counters are set up so that the data should be sufficient other than
  that there's no real way to convert back to source locations yet.

Let me know what you think. Thanks.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Driver-Accept-fprofile-instr-use-and-fprofile-instr-.patch
Type: text/x-patch
Size: 6359 bytes
Desc: Accept Instrumentation Flags
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131201/7d8c2ce4/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-CodeGen-Initial-instrumentation-based-PGO-implementa.patch
Type: text/x-patch
Size: 88578 bytes
Desc: Initial instrumentation based PGO implementation
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131201/7d8c2ce4/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-profile-Rudimentary-suppport-for-PGO-instrumentation.patch
Type: text/x-patch
Size: 3822 bytes
Desc: Rudimentary support for PGO
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131201/7d8c2ce4/attachment-0002.bin>

More information about the cfe-commits mailing list