[RISCV] Permit tail call to an externally-defined function with weak linkage
authorLiaoChunyu <chunyu@iscas.ac.cn>
Fri, 3 Feb 2023 01:16:49 +0000 (09:16 +0800)
committerLiaoChunyu <chunyu@iscas.ac.cn>
Fri, 3 Feb 2023 01:38:46 +0000 (09:38 +0800)
commit41fdb4c53f44281e4c7e26c2571395b9fc692cc4
tree54757b3956e42c6ca498b134e2ffca64380cd671
parenteba0bccf5af324b18d05a5ed51c320979ea83147
[RISCV] Permit tail call to an externally-defined function with weak linkage

As described in D45395 `This has been modeled after ARM's tail call opt.`
ARM's abi seems to limit weak symbol.

I did not find the limitation for RISCV. (Please correct me if I am wrong)

gcc seems to use the tail-call opt: https://godbolt.org/z/bjWE68n5o

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D143137
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/tail-calls.ll