This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Support the 'returned' parameter attribute.
ClosedPublic

Authored by aemerson on Feb 4 2021, 7:45 PM.

Details

Summary

On AArch64 (which seems to be the only target that supports it), this attribute allows codegen to avoid saving/restoring the value in x0 across a call.

Gives a 0.1% geomean -Os code size improvement on CTMark.

Diff Detail

Event Timeline

aemerson created this revision.Feb 4 2021, 7:45 PM
aemerson requested review of this revision.Feb 4 2021, 7:45 PM
arsenm added inline comments.Feb 5 2021, 6:02 AM
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
231

I think it would be better to move this to a proper function in CallLowering, and take a calling convention argument (also not a fan of using EVT, but I guess we're stuck with it for a while)

paquette added inline comments.Feb 5 2021, 9:43 AM
llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
271

Can we document this parameter?

llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
174

Comment would be useful here

llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp
1012

Would it make sense to make this a function, since it's the same as the code in lowerTailCall?

(The tail call/standard call code really needs to be refactored, so maybe it's better to leave it. I'm not sure.)

llvm/test/CodeGen/AArch64/arm64-this-return.ll
2

Would it make sense to add a MIR test for this as well? Or would that just be unnecessary test duplication?

aemerson updated this revision to Diff 321885.Feb 5 2021, 2:54 PM

Address comments.

This revision is now accepted and ready to land.Feb 8 2021, 11:29 AM
This revision was landed with ongoing or failed builds.Feb 8 2021, 12:47 PM
This revision was automatically updated to reflect the committed changes.