This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] S/390: Fix conditional returns
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Ilya Leoshkevich <iii at linux dot ibm dot com>
- Cc: gcc-patches at gcc dot gnu dot org, krebbel at linux dot ibm dot com, rdapp at linux dot ibm dot com
- Date: Tue, 18 Sep 2018 09:04:39 -0500
- Subject: Re: [PATCH] S/390: Fix conditional returns
- References: <20180905083448.1689-1-iii@linux.ibm.com>
On Wed, Sep 05, 2018 at 10:34:48AM +0200, Ilya Leoshkevich wrote:
> S/390 epilogue ends with (parallel [(return) (use %r14)]) instead of
> the more usual (return) or (simple_return). This sequence is not
> recognized by the conditional return logic in try_optimize_cfg ().
Why does it need this? Other targets with a link register make
EPILOGUE_USES handle this.
If you really need a parallel, can you make ANY_RETURN_P recognise it?
> +/* Create a copy of PARALLEL with side-effect OSIDE replaced by NSIDE. */
> +static rtx
> +copy_update_parallel (rtx par, rtx *oside, rtx nside)
> +{
> + rtx npar;
> + int i;
> +
> + npar = gen_rtx_PARALLEL (GET_MODE (par), rtvec_alloc (XVECLEN (par, 0)));
> + for (i = XVECLEN (par, 0) - 1; i >= 0; i--)
> + {
> + rtx *side_effect = &XVECEXP (par, 0, i);
> +
> + if (side_effect == oside)
> + XVECEXP (npar, 0, i) = nside;
> + else
> + XVECEXP (npar, 0, i) = copy_rtx (*side_effect);
> + }
> + return npar;
> +}
This doesn't work if nside is used anywhere else. But the only caller
uses the previous instruction pattern; maybe make a function specialised
to that only? You could give it a better name, too ;-) (It is especially
surprising because the function is called copy_* but it does _not_ copy
its argument!)
Segher