[PATCH] Add function entry count metadata.

Duncan P. N. Exon Smith dexonsmith at apple.com
Tue May 12 15:49:14 PDT 2015


> 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.

LGTM once you add the LangRef stuff Philip noticed.



More information about the llvm-commits mailing list