diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2015-10-27 09:07:44 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2015-10-27 09:07:44 +0000 |
commit | 4aecfe19869d2ba26ac4e4a967eb0b0cbf9b0114 (patch) | |
tree | 5c7ab69d5dcde81019b8826f1021e3c8de37e6dc /gcc | |
parent | 61183076f1dfbea5ac4fb6799aab9bc6e9aa8de5 (diff) | |
download | gcc-4aecfe19869d2ba26ac4e4a967eb0b0cbf9b0114.zip gcc-4aecfe19869d2ba26ac4e4a967eb0b0cbf9b0114.tar.gz gcc-4aecfe19869d2ba26ac4e4a967eb0b0cbf9b0114.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/gimple-match-head.c | 14 |
2 files changed, 17 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6f8f756..e1c46d5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-10-27 Richard Sandiford <richard.sandiford@arm.com> + + * 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 <rguenther@suse.de> * 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 8f72919..75f478c 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); |