[PATCH] Add function entry count metadata.

Diego Novillo dnovillo at google.com
Tue May 12 16:02:20 PDT 2015


On Tue, May 12, 2015 at 6:49 PM, Duncan P. N. Exon Smith
<dexonsmith at apple.com> wrote:
>
>> On 2015-May-12, at 14:53, Philip Reames <listmail at philipreames.com> wrote:
>>
>> Reading through the code, I was a left a bit confused as to the actual structure.  Could you update with the LangRef update so that it's easier to review?  Also, tests for correct usage would be helpful.
>>
>>
>> ================
>> Comment at: lib/IR/Function.cpp:995
>> @@ +994,3 @@
>> +  MDBuilder MDB(getContext());
>> +  setMetadata(LLVMContext::MD_prof, MDB.createFunctionEntryCount(Count));
>> +}
>> ----------------
>> I'm mildly bothered by using the same name for two different pieces of metadata.  Is there a reason not to use a different name here?
>>
>
> I'm fine with it.  Having the string (also for "branch_weights") bothers
> me intuitively since it blocks MDNode uniquing, but I guess it's better
> that you're consistent with what's there (and it's not like this is a
> major memory problem or anything).  Besides, if/when I can come up with
> a well-reasoned argument to remove it, it'll be trivial to upgrade out.

Sounds good. Thanks.

> LGTM once you add the LangRef stuff Philip noticed.

OK, thanks. Philip, I've added some content to the docs. Please let me
know it's enough or you want more details.

I think we may want to reorg the docs a bit, since
function_entry_count and branch_weights are related but they should be
in a "Profile" section, not in a "branch weights" section. I'll
address this in a future patch.


Diego.



More information about the llvm-commits mailing list