[PATCH] Add function entry count metadata.

Diego Novillo dnovillo at google.com
Wed May 13 07:57:32 PDT 2015


On Tue, May 12, 2015 at 9:08 PM, Duncan P. N. Exon Smith
<dexonsmith at apple.com> wrote:

> Check for null, too (`isa<>` asserts on null).

Done.

>> +      MDString *MDS = dyn_cast<MDString>(MD->getOperand(0));
>> +      StringRef ProfName = MDS->getString();
>> +      if (ProfName.equals("function_entry_count")) {
>
> This all seems unnecessarily complicated.  Might as well assert
> that it's "function_entry_count", and if/when we have something
> else we can add other logic.
>
> Similarly, just change the earlier check to `== 2`.

Done.

>> +        Assert(MD->getNumOperands() == 2,
>> +               "expected exactly one argument for function_entry_count", MD);
>> +        Assert(isa<ConstantAsMetadata>(MD->getOperand(1)),
>> +               "expected integer argument to function_entry_count", MD);
>
> Check for null, too (`isa<>` asserts on null).

Done.


Thanks.  Diego.



More information about the llvm-commits mailing list