diff options
author | Jakub Jelinek <jakub@redhat.com> | 2025-04-04 20:52:41 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2025-04-04 20:52:41 +0200 |
commit | d060d7a3ddc1c782e2800b1f68a2eb8f0de1fc32 (patch) | |
tree | 37730eba9967e78bdb8ef9e6f84aa8e3531491db /libjava/java/awt/dnd/DropTargetDragEvent.h | |
parent | 77e0c0df0907657a7d72bbba9e6329d93ec65edb (diff) | |
download | gcc-d060d7a3ddc1c782e2800b1f68a2eb8f0de1fc32.zip gcc-d060d7a3ddc1c782e2800b1f68a2eb8f0de1fc32.tar.gz gcc-d060d7a3ddc1c782e2800b1f68a2eb8f0de1fc32.tar.bz2 |
tailc: Don't reject all tail calls if param has addr taken [PR119616]
Before my PR119376 r15-9145 changes, suitable_for_tail_call_opt_p would
return the same value in the same caller, regardless of the calls in it.
If it fails, the caller clears opt_tailcalls which is a reference and
therefore shared by all calls in the caller and we only do tail recursion,
all non-recursive or tail recursion non-optimizable calls are not
tail call optimized.
For musttail calls we want to allow address taken parameters, but the
r15-9145 change effectively resulted in the behavior where if there
are just musttail calls considered, they will be tail call optimized,
and if there are also other tail call candidates (without musttail),
we clear opt_tailcall and then error out on all the musttail calls.
The following patch fixes that by moving the address taken parameter
discovery from suitable_for_tail_call_opt_p to its single caller.
If there are addressable parameters, if !cfun->has_musttail it will
work as before, disable all tail calls in the caller but possibly
allow tail recursions. If cfun->has_musttail, it will set a new
bool automatic flag and reject non-tail recursions. This way musttail
calls can be still accepted and normal tail call candidates rejected
(and tail recursions accepted).
2025-04-04 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/119616
* tree-tailcall.cc (suitable_for_tail_call_opt_p): Move checking
for addressable parameters from here ...
(find_tail_calls): ... here. If cfun->has_musttail, don't clear
opt_tailcalls for it, instead set a local flag and punt if we can't
tail recurse optimize it.
* c-c++-common/pr119616.c: New test.
Diffstat (limited to 'libjava/java/awt/dnd/DropTargetDragEvent.h')
0 files changed, 0 insertions, 0 deletions