From: Richard Sandiford Date: Tue, 27 Oct 2015 09:07:44 +0000 (+0000) Subject: Don't create SSA names until in SSA form X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4aecfe19869d2ba26ac4e4a967eb0b0cbf9b0114;p=gcc.git Don't create SSA names until in SSA form 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 use the usual: if (gimple_in_ssa_p (cfun)) res = make_ssa_name (type); else res = create_tmp_reg (type); formula to cope with cases where we're not yet in SSA form. Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi. gcc/ * gimple-match-head.c (maybe_push_res_to_seq): Use create_tmp_reg instead of make_ssa_name if not yet in SSA form. From-SVN: r229406 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6f8f756c728..e1c46d5f9e1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-10-27 Richard Sandiford + + * gimple-match-head.c (maybe_push_res_to_seq): Use create_tmp_reg + instead of make_ssa_name if not yet in SSA form. + 2015-10-27 Richard Biener * cfg.c (free_edge): Add function argument and use it instead of cfun. diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c index 8f7291912c7..75f478cc6f5 100644 --- a/gcc/gimple-match-head.c +++ b/gcc/gimple-match-head.c @@ -331,7 +331,12 @@ 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)) + res = make_ssa_name (type); + else + res = create_tmp_reg (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 +366,12 @@ 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)) + res = make_ssa_name (type); + else + res = create_tmp_reg (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);