This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Tail call memory intrinsics
ClosedPublic

Authored by paquette on Sep 13 2019, 10:40 AM.

Details

Summary

Because memory intrinsics are handled differently than other calls, we need to check them for tail call eligiblity in the legalizer. This allows us to still inline them when it's beneficial to do so, but also tail call when possible.

This adds simple tail calling support for when the intrinsic is followed by a return.

It ports the attribute checks from TargetLowering::isInTailCallPosition into a similarly-named function in LegalizerHelper.cpp. The target-specific isUsedByReturnOnly hook is not ported here.

Update tailcall-mem-intrinsics.ll to show that GlobalISel can now tail call memory intrinsics.

Update legalize-memcpy-et-al.mir to have a case where we don't tail call.

Diff Detail

Event Timeline

paquette created this revision.Sep 13 2019, 10:40 AM
paquette updated this revision to Diff 220145.Sep 13 2019, 11:16 AM

Add missing check for when the return is a tail call.

aemerson added inline comments.Sep 13 2019, 11:39 AM
llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
98

Can you make it clearer in this comment that it's done by the legalizer.

llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
335

A comment here would be useful.

llvm/test/CodeGen/AArch64/tailcall-mem-intrinsics.ll
2

-global-isel-abort=1?

paquette updated this revision to Diff 220148.Sep 13 2019, 11:48 AM

Update comments, add -global-isel-abort=1 to test

aemerson accepted this revision.Sep 13 2019, 1:07 PM
This revision is now accepted and ready to land.Sep 13 2019, 1:07 PM
This revision was automatically updated to reflect the committed changes.