diff options
author | Andi Kleen <ak@linux.intel.com> | 2024-06-01 22:04:41 -0700 |
---|---|---|
committer | Andi Kleen <ak@gcc.gnu.org> | 2024-07-17 21:24:47 -0700 |
commit | 983daf0e5fdaada5b930374c21455d42d34350be (patch) | |
tree | 3de1b8c2379217858414d775b9df70d8b66bbafd /gcc/function.cc | |
parent | a6502accf381358173b19e615fdeb0aa17949c93 (diff) | |
download | gcc-983daf0e5fdaada5b930374c21455d42d34350be.zip gcc-983daf0e5fdaada5b930374c21455d42d34350be.tar.gz gcc-983daf0e5fdaada5b930374c21455d42d34350be.tar.bz2 |
Fix pro_and_epilogue for sibcalls at -O0 (PR115255)
Some of the cfg fixups in pro_and_epilogue for sibcalls were dependent on "optimize".
Make them check cfun->tail_call_marked instead to handle the -O0 musttail
case. This fixes the musttail test cases on arm targets.
gcc/ChangeLog:
PR target/115255
* function.cc (thread_prologue_and_epilogue_insns): Check
cfun->tail_call_marked for sibcalls too.
(rest_of_handle_thread_prologue_and_epilogue): Dito.
Diffstat (limited to 'gcc/function.cc')
-rw-r--r-- | gcc/function.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/function.cc b/gcc/function.cc index 4edd4da..a6f6de3 100644 --- a/gcc/function.cc +++ b/gcc/function.cc @@ -2231,6 +2231,7 @@ use_register_for_decl (const_tree decl) /* We don't set DECL_IGNORED_P for the function_result_decl. */ if (optimize) return true; + /* Needed for [[musttail]] which can operate even at -O0 */ if (cfun->tail_call_marked) return true; /* We don't set DECL_REGISTER for the function_result_decl. */ @@ -6259,8 +6260,11 @@ thread_prologue_and_epilogue_insns (void) } /* Threading the prologue and epilogue changes the artificial refs in the - entry and exit blocks, and may invalidate DF info for tail calls. */ + entry and exit blocks, and may invalidate DF info for tail calls. + This is also needed for [[musttail]] conversion even when not + optimizing. */ if (optimize + || cfun->tail_call_marked || flag_optimize_sibling_calls || flag_ipa_icf_functions || in_lto_p) @@ -6557,7 +6561,7 @@ rest_of_handle_thread_prologue_and_epilogue (function *fun) { /* prepare_shrink_wrap is sensitive to the block structure of the control flow graph, so clean it up first. */ - if (optimize) + if (cfun->tail_call_marked || optimize) cleanup_cfg (0); /* On some machines, the prologue and epilogue code, or parts thereof, |