[LoongArch] Implement mayBeEmittedAsTailCall for tail call optimization
authorwanglei <wanglei@loongson.cn>
Thu, 12 Jan 2023 02:33:11 +0000 (10:33 +0800)
committerwanglei <wanglei@loongson.cn>
Thu, 12 Jan 2023 03:08:30 +0000 (11:08 +0800)
commitd7cd42192216939b29a06093be7b296050856d7a
tree5836b993c74f9b76a77d38435c36fe4da7155ffb
parent6e18277a51187ce8e861cdf0ab1395235e5b83d4
[LoongArch] Implement mayBeEmittedAsTailCall for tail call optimization

Implements TargetLowering callback `mayBeEmittedAsTailCall` that enables
CodeGenPrepare to duplicate returns when they might enable a tail-call.

Reviewed By: xen0n, MaskRay

Differential Revision: https://reviews.llvm.org/D141257
llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
llvm/lib/Target/LoongArch/LoongArchISelLowering.h
llvm/test/CodeGen/LoongArch/bnez-beqz.ll
llvm/test/CodeGen/LoongArch/duplicate-returns-for-tailcall.ll [new file with mode: 0644]