This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Tail calls don't need to save return address
ClosedPublic

Authored by sabuasal on Jun 19 2018, 5:29 PM.

Details

Summary

When expanding the PseudoTail in expandFunctionCall() we were using X6
to save the return address. Since this is a tail call the return
address is not needed, this patch replaces it with X0 to be ignored.

This matches the behaviour listed in the ISA V2.2 document page 110.
tail offset -----> jalr x0, x6, offset

GCC exhibits the same behavior.

Diff Detail

Repository
rL LLVM

Event Timeline

sabuasal created this revision.Jun 19 2018, 5:29 PM
asb accepted this revision.Jun 20 2018, 3:58 AM

Looks good to me, thanks!

This revision is now accepted and ready to land.Jun 20 2018, 3:58 AM
This revision was automatically updated to reflect the committed changes.