https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90418

--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #1)
> Most likely similar problem to the one analyzed in PR59813, after all, it is
> the same function.  Previously, in that function there were no tail calls
> and most likely no tailcalls in any function with __builtin_eh_return call,
> now it is possible, so various targets need to either catch up and handle
> that case properly, or declare they don't want to support tailcalls if
> cfun->calls_eh_return in *_ok_for_sibcall target hook.

thanks for the suggestion, I tried disabling sib calls when
crtl->calls_eh_return (it is probably something that should be done anyway,
given what's below).  That's not sufficient to resolve the bug.

We actually generate correct code for -O1, but fail at -O2,3,s.

There seem to be two problems.

powerpc-darwin has a facility for the unwinder that allows the same binary to
run on a machine with or without altivec.  The unwind save/restore is delegated
to a function "save_world" that tests an OS bit to determine if the altivec
regs should be saved/restored.

1) We are correctly calling this for <= O1
 - We are not (for some TBD reason) calling it at greater optimisations.

2) however, it's not clear why the current generated code isn't lowerable (even
if it would not work at runtime on a machine without altivec).

longer-term there's an intention to remove the "save_world" machinery, but we
have to replace the relevant routines in libgcc to do that.  It seems that
right now if we just switched it off, the codegen would fail anyway.

Reply via email to