Add GCC-compatible flags -fprofile-generate and -fprofile-use

Justin Bogner mail at justinbogner.com
Tue Jul 7 17:44:08 PDT 2015


Richard Smith <richard at metafoo.co.uk> writes:
> On Tue, Jul 7, 2015 at 11:35 AM, Diego Novillo <dnovillo at google.com> wrote:
>
>     ping?
>
> +  Without any other arguments, ``-fprofile-generate`` behaves identically to
> +  ``-fprofile-instr-generate``. When given a directory name, it generates the
> +  profile file ``default.profraw`` in the directory named ``dirname``. If
> +  ``dirname`` does not exist, it will be created. The environment variable
>
> Maybe "it will be created at runtime." to clarify that we won't create a
> directory as a side-effect of the compile.
>
> Is it possible to transform -fprofile-instr-generate into
> -fprofile-instr-generate=default.profraw and remove frontend support for the
> non-= form? (If so, I'm happy with that being a follow-up patch.)

Diego and I discussed this already - it's problematic because it means
that we need to always pass the filename to compiler-rt. Currently doing
so causes us to inject a static constructor into the instrumented
program, and there are cases where we don't want to do that.

At some point we should rework how we get the filename into compiler-rt
to avoid the initializer and then we should make this change as well,
but I don't think that should hold up this patch.

> I think it'd be slightly better for -fprofile-generate= to override
> -fprofile-instr-generate= and vice versa (last on the command line wins)
> rather than making them conflict.

I agree - this should make the code simpler and is a bit more like how
similar flags work.

> Otherwise, frontend patch LGTM.

Me too. I'll take a look at the compiler-rt patch in a second.

>
>     Thanks.  Diego.
>    
>     On Wed, Jul 1, 2015 at 7:33 AM, Diego Novillo <dnovillo at google.com> wrote:
>     > I've updated the frontend and runtime patches based on the discussions
>     > we had in this thread and IRC.
>     >
>     > Thanks.  Diego.
>     _______________________________________________
>     cfe-commits mailing list
>     cfe-commits at cs.uiuc.edu
>     http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list