On Mon, Oct 26, 2015 at 10:36 AM, Richard Sandiford
<rdsandif...@googlemail.com> wrote:
> An upcoming patch adds a fold from hypot(x,x) to fabs(x)*sqrt(2).
> This is unusual in that it could trigger in the gimplifier but would
> require new SSA names to be created.  This patch makes sure that we
> don't try to create new SSA names when we're not yet in SSA form.
>
> Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi.
> OK to install?

Please use

 if (gimple_in_ssa_p (cfun))
  res = make_ssa_name (type);
 else
  res = create_tmp_reg (type);

Ok with that change.

Thanks,
Richard.

> Thanks,
> Richard
>
>
> gcc/
>         * gimple-match-head.c (maybe_push_res_to_seq): Don't attempt
>         to create new SSA names if not in SSA form.
>
> diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c
> index 8f72919..1345cf9 100644
> --- a/gcc/gimple-match-head.c
> +++ b/gcc/gimple-match-head.c
> @@ -331,7 +331,11 @@ maybe_push_res_to_seq (code_helper rcode, tree type, 
> tree *ops,
>               && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[2])))
>         return NULL_TREE;
>        if (!res)
> -       res = make_ssa_name (type);
> +       {
> +         if (!gimple_in_ssa_p (cfun))
> +           return NULL_TREE;
> +         res = make_ssa_name (type);
> +       }
>        maybe_build_generic_op (rcode, type, &ops[0], ops[1], ops[2]);
>        gimple *new_stmt = gimple_build_assign (res, rcode,
>                                              ops[0], ops[1], ops[2]);
> @@ -361,7 +365,11 @@ maybe_push_res_to_seq (code_helper rcode, tree type, 
> tree *ops,
>         }
>        gcc_assert (nargs != 0);
>        if (!res)
> -       res = make_ssa_name (type);
> +       {
> +         if (!gimple_in_ssa_p (cfun))
> +           return NULL_TREE;
> +         res = make_ssa_name (type);
> +       }
>        gimple *new_stmt = gimple_build_call (decl, nargs, ops[0], ops[1], 
> ops[2]);
>        gimple_call_set_lhs (new_stmt, res);
>        gimple_seq_add_stmt_without_update (seq, new_stmt);
>

Reply via email to