]> git.ipfire.org Git - thirdparty/gcc.git/commit
Enable musttail tail conversion even when not optimizing
authorAndi Kleen <ak@linux.intel.com>
Thu, 16 May 2024 02:57:22 +0000 (19:57 -0700)
committerAndi Kleen <ak@gcc.gnu.org>
Thu, 18 Jul 2024 04:25:27 +0000 (21:25 -0700)
commitb738a63e528db410a1c51fc27db37fe22f0cb397
tree3e936f2f0c193eb17934f561847f3fc7a40d0f42
parent983daf0e5fdaada5b930374c21455d42d34350be
Enable musttail tail conversion even when not optimizing

Enable the tailcall optimization for non optimizing builds,
but in this case only checks calls that have the musttail attribute set.
This makes musttail work without optimization.

This is done with a new late musttail pass that is only active when
not optimizing. The new pass relies on tree-cfg to discover musttails.
This avoids a ~0.8% compiler run time penalty at -O0.

gcc/ChangeLog:

PR c/83324
* function.h (struct function): Add has_musttail.
* lto-streamer-in.cc (input_struct_function_base): Stream
has_musttail.
* lto-streamer-out.cc (output_struct_function_base): Dito.
* passes.def (pass_musttail): Add.
* tree-cfg.cc (notice_special_calls): Record has_musttail.
(clear_special_calls): Clear has_musttail.
* tree-pass.h (make_pass_musttail): Add.
* tree-tailcall.cc (find_tail_calls): Handle only_musttail
argument.
(tree_optimize_tail_calls_1): Pass on only_musttail.
(execute_tail_calls): Pass only_musttail as false.
(class pass_musttail): Add.
(make_pass_musttail): Add.
gcc/function.h
gcc/lto-streamer-in.cc
gcc/lto-streamer-out.cc
gcc/passes.def
gcc/tree-cfg.cc
gcc/tree-pass.h
gcc/tree-tailcall.cc