[cfe-dev] [LLVMdev] Function-level metadata for OpenCL (was Re: OpenCL support)

Frits van Bommel fvbommel at gmail.com
Mon Dec 20 13:53:21 PST 2010


On Mon, Dec 20, 2010 at 9:11 PM, Peter Collingbourne <peter at pcc.me.uk> wrote:
> Nick Lewycky wrote:
>> Being discardable is a design point of metadata. You might add something
>> else to support this, but it won't be metadata.
>
> There's nothing intrinsic about the concept of metadata which requires
> it to be discardable.  In particular, if the metadata is attached to
> a function, the only case I can think of where an optimiser needs
> to touch the metadata is if a function with metadata is inlined.

There may be cases where an optimization pass doesn't know how to
update metadata, so discarding it is the only way to prevent invalid
metadata while still performing the transformation.
If metadata would be attached to functions, that means passes like
dead argument elimination may need to remove it since they create a
new function (with a different type), and the metadata may depend on
the function type staying the same. For instance: the metadata may
contain references to parameter numbers for all it knows, and it won't
know how to change that to account for the removed parameters.




More information about the cfe-dev mailing list