Here is a patch to improve the tail recursion handling also for
non-musttail calls.
2025-04-28 Jakub Jelinek <jakub@redhat.com>
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.
? !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;
}
}