On Tue, Apr 01, 2025 at 11:51:49AM +0200, Jakub Jelinek wrote:
> Here it is, ok if it passes bootstrap/regtest?  I'll queue the interdiff
> between this patch and the previous one for GCC 16.

Here is the interdiff to improve the tail recursion handling also for
non-musttail calls.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2025-04-24  Jakub Jelinek  <ja...@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.

--- gcc/tree-tailcall.cc.jj     2025-04-01 16:47:30.373502796 +0200
+++ gcc/tree-tailcall.cc        2025-04-01 20:08:34.578787921 +0200
@@ -685,8 +685,7 @@ find_tail_calls (basic_block bb, struct
                  ? !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;
            }
        }


        Jakub

Reply via email to