[llvm-commits] [llvm] r93400 - in /llvm/trunk: include/llvm/Metadata.h lib/VMCore/Metadata.cpp

Devang Patel devang.patel at gmail.com
Thu Jan 14 12:56:10 PST 2010


On Thu, Jan 14, 2010 at 12:15 PM, Victor Hernandez <vhernandez at apple.com> wrote:
>
> On Jan 14, 2010, at 10:20 AM, Victor Hernandez wrote:
>
>>
>> On Jan 14, 2010, at 9:39 AM, Devang Patel wrote:
>>
>>> On Wed, Jan 13, 2010 at 5:45 PM, Victor Hernandez <vhernandez at apple.com> wrote:
>>>> Author: hernande
>>>> Date: Wed Jan 13 19:45:14 2010
>>>> New Revision: 93400
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=93400&view=rev
>>>> Log:
>>>> Add MDNode::getFunction(), which figures out the metadata's function, if it has function that it is local to.
>>>
>>> so will this replace isFunctionLocal() ?
>>
>> No, I don't think it should replace isFunctionLocal().  getFunction() is an expensive operation that should not be used in performance-critical tasks (currently it is only used when printing out ll files).  isFunctionLocal() is fast and will very rarely give a false positive (when a metadata is created function-local, but then the operands are modified later).
>
> After our discussion, I am more amenable to replacing isFunctionLocal() with getFunction().  I just committed a debug version of getFunction() that asserts that function-local metadata has only 1 parent function.
>
> I agree that avoiding the traversal of the MD operands at metadata-creation time helps performance.  I need to make sure that none of the users of isFunctionLocal() are performance-critical or called alot.
>

ok. Thanks!

-- 
-
Devang




More information about the llvm-commits mailing list