This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue with notail on x86-64
ClosedPublic

Authored by ahatanak on Mar 21 2019, 11:09 AM.

Details

Summary

On x86-64, the epilogue code inserted before the tail jump blocks the autoreleased return optimization.

ARC optimizer unconditionally turns calls to objc_retainAutoreleasedReturnValue to tail calls. I plan to fix that too after this patch lands.

rdar://problem/38675807

Diff Detail

Repository
rL LLVM

Event Timeline

ahatanak created this revision.Mar 21 2019, 11:09 AM

There are existing test cases that test notail isn't added to calls on targets that aren't x86-64 (for example, test/CodeGenObjC/arc-arm.m), so I didn't write a new one.

rjmccall added inline comments.Mar 21 2019, 11:35 AM
lib/CodeGen/TargetInfo.h
161 ↗(On Diff #191737)

shouldSuppressTailCallsOfRetainAutoreleasedReturnValue()?

ahatanak updated this revision to Diff 191761.Mar 21 2019, 12:13 PM
ahatanak marked an inline comment as done.

Rename function.

This revision is now accepted and ready to land.Mar 21 2019, 12:41 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2019, 1:00 PM