[PATCH] Attach "objc-arc" function attribute to function definitions compiled in a module with ARC enabled.

Michael Gottesman mgottesman at apple.com
Wed May 15 14:27:43 PDT 2013


Hey Fariborz!

I think that predicating this on LTO may be the wrong thing to do [but please correct me if I am wrong as always = )].

Specifically, the use case for this attribute is to not run ARC optimization passes when a function does not have an ``objc-arc'' attribute on it during the post transformation stage of LTO. If we predicate this attribute on LTO being enabled, the arc optimizer passes would necessarily need to know to not look for the attribute when LTO is disabled and to look for the attribute when LTO is enabled. Currently none of the optimization passes know whether or not they are being used to optimize IR for LTO; An optimization pass just optimizes IR (a de facto invariant).

As such, no plumbing currently exists in LLVM for optimization passes to know whether or not they are being used in an LTO setting. I am unsure if this use case would justify adding that plumbing and additionally if allowing the passes to do that would open up all sorts of cans of worms.

Tell me what you think,
Michael

On May 15, 2013, at 11:15 AM, Michael Gottesman <mgottesman at apple.com> wrote:

> Good point (updating patch).
> 
> Michael
> 
> On May 15, 2013, at 11:09 AM, jahanian <fjahanian at apple.com> wrote:
> 
>> If this attribute is consumed by LTO, why can’t we set when in LTO optimization mode only?
>> - fariborz
>> 
>> On May 15, 2013, at 10:59 AM, Michael Gottesman <mgottesman at apple.com> wrote:
>> 
>>> The following patch attaches to all function definitions in a module compiled with ARC the function attribute "objc-arc". This enables us to know which functions to run ObjCARCContract on when we compile ARC applications with LTO.
>>> 
>>> Please Review,
>>> Michael
>>> 
>>> <0001-When-we-are-compiling-in-ObjC-ARC-Mode-place-an-objc.patch>_______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130515/341c4874/attachment.html>


More information about the cfe-commits mailing list