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

Diego Novillo dnovillo at google.com
Wed Jul 8 16:19:09 PDT 2015


On Wed, Jul 8, 2015 at 4:05 PM, Diego Novillo <dnovillo at google.com> wrote:
> On Tue, Jul 7, 2015 at 5:55 PM, Justin Bogner <mail at justinbogner.com> wrote:
>> Diego Novillo <dnovillo at google.com> writes:
>>> I've updated the frontend and runtime patches based on the discussions
>>> we had in this thread and IRC.
>>>
>>> Thanks.  Diego.
>>>
>>>
>>> commit b0ac1b3d8529318bed75c89b44d0b0a03c0d3497
>>> Author: Diego Novillo <dnovillo at google.com>
>>> Date:   Thu Jun 25 18:50:33 2015 -0400
>>>
>>>     Add support for generating profiles in a given directory.
>>>
>>>     When the file is initialized, this patch checks whether the path
>>>     specifies a directory. If so, it creates the directory tree before
>>>     truncating the file.
>>>
>>>     Use default.profdata instead of pgo-data for default indexed profile name.
>>>
>>> diff --git a/lib/profile/GCDAProfiling.c b/lib/profile/GCDAProfiling.c
>>> index e32e97f..e245cf0 100644
>>> --- a/lib/profile/GCDAProfiling.c
>>> +++ b/lib/profile/GCDAProfiling.c
>>> @@ -20,6 +20,8 @@
>>>  |*
>>>  \*===----------------------------------------------------------------------===*/
>>>
>>> +#include "InstrProfiling.h"
>>> +
>>>  #include <errno.h>
>>>  #include <fcntl.h>
>>>  #include <stdio.h>
>>> @@ -209,7 +211,8 @@ static char *mangle_filename(const char *orig_filename) {
>>>    return new_filename;
>>>  }
>>>
>>> -static void recursive_mkdir(char *path) {
>>> +__attribute__((visibility("hidden")))
>>> +void __llvm_profile_recursive_mkdir(char *path) {
>>
>> Better break this out of GCDAProfiling.c into a separate file - we don't
>> want to force InstrProfiling to pull in GCDAProfiling symbols, and it's
>> a layering violation for GCDAProfiling to be #including
>> InstrProfiling.h.
>
> I had initially moved it into InstrProfiling.c.  Would that be OK?

Sorry.  That was a dumb question.  I can only do this change by
creating a new file altogether.


Diego.



More information about the cfe-commits mailing list