[PATCH] S/390: Fix conditional returns

Segher Boessenkool segher@kernel.crashing.org
Tue Sep 18 14:10:00 GMT 2018


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



More information about the Gcc-patches mailing list