From b0120fa9838f8fbeb13301d03b01cad282941569 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 28 Apr 2025 09:22:50 +0200 Subject: [PATCH] tailc: Improve tail recursion handling [PR119493] Here is a patch to improve the tail recursion handling also for non-musttail calls. 2025-04-28 Jakub Jelinek PR tree-optimization/119493 * tree-tailcall.cc (find_tail_calls): Handle non-gimple_reg_type arguments which aren't just passed through for tail recursions even for non-musttail calls. --- gcc/tree-tailcall.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gcc/tree-tailcall.cc b/gcc/tree-tailcall.cc index f593363dae4..fc05928cd68 100644 --- a/gcc/tree-tailcall.cc +++ b/gcc/tree-tailcall.cc @@ -827,8 +827,7 @@ find_tail_calls (basic_block bb, struct tailcall **ret, bool only_musttail, ? !is_gimple_reg (param) : (!is_gimple_variable (param) || TREE_THIS_VOLATILE (param) - || may_be_aliased (param) - || !gimple_call_must_tail_p (call))) + || may_be_aliased (param))) break; } } -- 2.47.2