[cfe-dev] ARC + array literal patch feedback request

John McCall rjmccall at apple.com
Fri Mar 22 17:19:29 PDT 2013

On Mar 22, 2013, at 5:11 PM, Jesse Rusak <me at jesserusak.com> wrote:
> On 2013-03-22, at 8:11 PM, John McCall <rjmccall at apple.com> wrote:
>> On Mar 22, 2013, at 4:02 PM, Jesse Rusak <me at jesserusak.com> wrote:
>>> First, I think the ARC contract phase only runs under -O1 or higher, so calls to @clang.arc.use will remain under -O0 and cause link-time errors. I was thinking of either changing EmitAssemblyHelper::AddEmitPasses to always include the contract pass, or else move the erasure logic elsewhere (perhaps to a new, later ARC pass).
>> Oh, you're underestimating how hacky the interaction between IR-gen and the optimizer is here. :)  The ARC contract pass is essentially an ARC-specific codegen prepare pass that cleans up things that we want the optimizer to see (or not see).  For example, it inserts the objc_retainAutoreleaseReturnValue assembly markers, which the frontend is responsible for at -O0 but which would really annoy/disable the optimizer if we emitted them at -O1 or higher.
>> So the solution is to just not emit these intrinsic calls at -O0.
> Ah! I had considered that, but I was worried that omitting those calls would bring back the original problem. Thinking through it more, though, there can't be an early release under -O0, since there's no motion of the objc_releases. That does seem a *bit* hacky. :)

No argument!

>> I'm actually going to land a patch for a different but similar miscompile soon — this one with the writeback-from-out-parameter operation.  So the frontend will have the basic infrastructure for this already.
> OK, great. I'll wait for your patch and go from there. Thanks again for all the exposition.

No problem.


More information about the cfe-dev mailing list