Add -fauto-profile option to Clang driver

Chandler Carruth chandlerc at
Tue Oct 22 14:06:34 PDT 2013

On Tue, Oct 22, 2013 at 1:58 PM, Bob Wilson <bob.wilson at> wrote:

> I really like GCC's -fprofile-generate and -fprofile-use, except I don't
> think we should reuse those names for something that works differently.  My
> overall preference would be something like this (using those names as
> placeholders):
> -fprofile-generate=<instrumentation-style>
> -fprofile-use=<profile-style>
> e.g., "-fprofile-use=auto".  That would at least unify the new options.
>  In fact, we may even be able to reuse those option names with
> -fprofile-use being a synonym for -fprofile-use=gcc, which matches gcc's
> option.  I'm not at all familiar with how that option actually works in
> gcc, so I can't say whether that would make sense.

I don't think we can re-use '-fprofile-use' in a way different from GCC
here. GCC accepts it as "-fprofile-use=/path/..." and i could call my
profile file "auto" or "gcc" or "clang" and expect it to work.

I think it is best for instrumentation-based profiling to use
'-fprofile-generate' and '-fprofile-use' just like GCC does, if with
different file formats, etc.

I don't see in flags in upstream GCC regarding sample-driven profiling, but
"auto" I think is actively harmful in the name. There is nothing
intrinsically automatic about it. It is "external" in the sense that it
isn't from compiled-in instrumentation, but I don't see any reason for
"auto" to indicate that to the user.

I think for now, we should put this functionality behind a specific flag
whose name is indicative of the user's expected behavior. The best idea
I've seen is "-fsample-profile=/path/..." but I'd love to hear better
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the cfe-commits mailing list