summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog73
-rw-r--r--gcc/tree-if-conv.c21
-rw-r--r--gcc/tree-loop-distribution.c3
-rw-r--r--gcc/tree-parloops.c12
-rw-r--r--gcc/tree-profile.c19
-rw-r--r--gcc/tree-sra.c5
-rw-r--r--gcc/tree-ssa-forwprop.c17
-rw-r--r--gcc/tree-ssa-loop-im.c24
-rw-r--r--gcc/tree-ssa-loop-manip.c15
-rw-r--r--gcc/tree-ssa-math-opts.c171
-rw-r--r--gcc/tree-ssa-phiopt.c55
-rw-r--r--gcc/tree-ssa-phiprop.c5
-rw-r--r--gcc/tree-ssa-pre.c49
-rw-r--r--gcc/tree-ssa-propagate.c8
-rw-r--r--gcc/tree-ssa-reassoc.c55
-rw-r--r--gcc/tree-ssa-strlen.c17
-rw-r--r--gcc/tree-switch-conversion.c10
-rw-r--r--gcc/tree-tailcall.c12
-rw-r--r--gcc/tree-vect-data-refs.c28
-rw-r--r--gcc/tree-vect-generic.c3
-rw-r--r--gcc/tree-vect-loop-manip.c22
-rw-r--r--gcc/tree-vect-patterns.c22
-rw-r--r--gcc/tree-vect-stmts.c6
-rw-r--r--gcc/tree-vrp.c12
-rw-r--r--gcc/value-prof.c39
25 files changed, 287 insertions, 416 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b88e404c291..d7f463e534f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,76 @@
+2012-08-10 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-pre.c (pretemp, storetemp, prephitemp): Remove.
+ (need_creation): Remove.
+ (get_representative_for): Use anonymous named SSA names.
+ (create_expression_by_pieces): Likewise.
+ (insert_into_preds_of_block): Likewise.
+ (init_pre): Do not init removed vars.
+ (fini_pre): Do not free need_creation.
+ * tree-ssa-forwprop.c (simplify_bitwise_binary): Use anonymous
+ SSA names.
+ * tree-ssa-loop-manip.c (create_iv): Likewise.
+ * value-prof.c (gimple_divmod_fixed_value): Likewise.
+ (gimple_mod_pow2): Likewise.
+ (gimple_mod_subtract): Likewise.
+ (gimple_ic): Likewise.
+ (gimple_stringop_fixed_value): Likewise.
+ * tree-ssa-phiopt.c (condstoretemp): Remove.
+ (tree_ssa_phiopt_worker): Use anonymous named SSA names.
+ (conditional_replacement): Likewise.
+ (abs_replacement): Likewise.
+ (cond_store_replacement): Likewise.
+ (cond_if_else_store_replacement_1): Likewise.
+ * tree-ssa-loop-im.c (rewrite_reciprocal): Likewise.
+ (rewrite_bittest): Likewise.
+ * tree-ssa-reassoc.c (build_and_add_sum): Get type from callers
+ and build anonymous SSA names.
+ (undistribute_ops_list): Adjust.
+ (eliminate_redundant_comparison): Use anonymous SSA names.
+ (rewrite_expr_tree_parallel): Likewise.
+ (get_reassoc_pow_ssa_name): Remove.
+ (attempt_builtin_powi): Adjust.
+ (reassociate_bb): Likewise.
+ * tree-ssa-strlen.c (get_string_length): Use anonymous SSA names.
+ * tree-switch-conversion.c (emit_case_bit_tests): Likewise.
+ (build_arrays): Likewise.
+ * tree-tailcall.c (adjust_return_value_with_ops): Likewise.
+ (create_tailcall_accumulator): Likewise.
+ * tree-vect-generic.c (expand_vector_divmod): Likewise.
+ * tree-profile.c (gcov_type_tmp_var): Remove.
+ (gimple_init_edge_profiler): Do not initialize it and use anonymous
+ SSA names.
+ (gimple_gen_ic_profiler): Likewise.
+ (tree_profiling): Adjust.
+ * tree-sra.c (build_ref_for_offset): Use anonymous SSA names.
+ * tree-ssa-math-opts.c (execute_cse_sincos_1): Likewise.
+ (powi_as_mults_1): Likewise.
+ (powi_as_mults): Likewise.
+ (build_and_insert_call): Adjust.
+ (build_and_insert_binop): Likewise.
+ (build_and_insert_ref): Likewise.
+ (build_and_insert_cast): Likewise.
+ (gimple_expand_builtin_pow): Likewise.
+ (gimple_expand_builtin_cabs): Likewise.
+ (execute_optimize_bswap): Use anonymous SSA names.
+ (convert_mult_to_widen): Likewise.
+ (convert_plusminus_to_widen): Likewise.
+ * tree-ssa-phiprop.c (phiprop_insert_phi): Likewise.
+ * tree-ssa-propagate.c (update_call_from_tree): Likewise.
+ * tree-if-conv.c (ifc_temp_var): Likewise.
+ * tree-loop-distribution.c (generate_memset_builtin): Likewise.
+ * tree-parloops.c (take_address_of): Likewise.
+ * tree-vect-data-refs.c (vect_permute_store_chain): Likewise.
+ (vect_permute_load_chain): Likewise.
+ * tree-vect-loop-manip.c (vect_create_cond_for_align_checks): Likewise.
+ * tree-vect-patterns.c (vect_recog_temp_ssa_var): Likewise.
+ (vect_handle_widen_op_by_const): Likewise.
+ (vect_operation_fits_smaller_type): Likewise.
+ (vect_recog_over_widening_pattern): Likewise.
+ * tree-vect-stmts.c (vect_init_vector): Likewise.
+ * tree-vrp.c (simplify_truth_ops_using_ranges): Likewise.
+ (simplify_float_conversion_using_ranges): Likewise.
+
2012-08-10 Michael Zolotukhin <michael.v.zolotukhin@intel.com>
* config/i386/i386.c (ix86_init_mmx_sse_builtins): Fix builtin
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 56d375a3ce3..828969103a3 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -221,25 +221,10 @@ reset_bb_predicate (basic_block bb)
static tree
ifc_temp_var (tree type, tree expr, gimple_stmt_iterator *gsi)
{
- const char *name = "_ifc_";
- tree var, new_name;
- gimple stmt;
-
- /* Create new temporary variable. */
- var = create_tmp_var (type, name);
-
- /* Build new statement to assign EXPR to new variable. */
- stmt = gimple_build_assign (var, expr);
-
- /* Get SSA name for the new variable and set make new statement
- its definition statement. */
- new_name = make_ssa_name (var, stmt);
- gimple_assign_set_lhs (stmt, new_name);
- SSA_NAME_DEF_STMT (new_name) = stmt;
- update_stmt (stmt);
-
+ tree new_name = make_temp_ssa_name (type, NULL, "_ifc_");
+ gimple stmt = gimple_build_assign (new_name, expr);
gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
- return gimple_assign_lhs (stmt);
+ return new_name;
}
/* Return true when COND is a true predicate. */
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 394a38c3dba..377b544b40d 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -391,8 +391,7 @@ generate_memset_builtin (struct loop *loop, partition_t partition)
else if (!useless_type_conversion_p (integer_type_node, TREE_TYPE (val)))
{
gimple cstmt;
- tree tem = create_tmp_reg (integer_type_node, NULL);
- tem = make_ssa_name (tem, NULL);
+ tree tem = make_ssa_name (integer_type_node, NULL);
cstmt = gimple_build_assign_with_ops (NOP_EXPR, tem, val, NULL_TREE);
gsi_insert_after (&gsi, cstmt, GSI_CONTINUE_LINKING);
val = tem;
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index e79eef47802..224d546b755 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -452,7 +452,7 @@ take_address_of (tree obj, tree type, edge entry, htab_t decl_address,
int uid;
void **dslot;
struct int_tree_map ielt, *nielt;
- tree *var_p, name, bvar, addr;
+ tree *var_p, name, addr;
gimple stmt;
gimple_seq stmts;
@@ -479,12 +479,10 @@ take_address_of (tree obj, tree type, edge entry, htab_t decl_address,
if (gsi == NULL)
return NULL;
addr = TREE_OPERAND (*var_p, 0);
- bvar = create_tmp_var (TREE_TYPE (addr),
- get_name (TREE_OPERAND
- (TREE_OPERAND (*var_p, 0), 0)));
- stmt = gimple_build_assign (bvar, addr);
- name = make_ssa_name (bvar, stmt);
- gimple_assign_set_lhs (stmt, name);
+ name = make_temp_ssa_name (TREE_TYPE (addr), NULL,
+ get_name (TREE_OPERAND
+ (TREE_OPERAND (*var_p, 0), 0)));
+ stmt = gimple_build_assign (name, addr);
gsi_insert_on_edge_immediate (entry, stmt);
nielt = XNEW (struct int_tree_map);
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 676461cd087..a5b6bc80281 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -44,7 +44,6 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
static GTY(()) tree gcov_type_node;
-static GTY(()) tree gcov_type_tmp_var;
static GTY(()) tree tree_interval_profiler_fn;
static GTY(()) tree tree_pow2_profiler_fn;
static GTY(()) tree tree_one_value_profiler_fn;
@@ -209,20 +208,18 @@ gimple_init_edge_profiler (void)
void
gimple_gen_edge_profiler (int edgeno, edge e)
{
- tree ref, one;
+ tree ref, one, gcov_type_tmp_var;
gimple stmt1, stmt2, stmt3;
- /* We share one temporary variable declaration per function. This
- gets re-set in tree_profiling. */
- if (gcov_type_tmp_var == NULL_TREE)
- gcov_type_tmp_var = create_tmp_reg (gcov_type_node, "PROF_edge_counter");
ref = tree_coverage_counter_ref (GCOV_COUNTER_ARCS, edgeno);
one = build_int_cst (gcov_type_node, 1);
+ gcov_type_tmp_var = make_temp_ssa_name (gcov_type_node,
+ NULL, "PROF_edge_counter");
stmt1 = gimple_build_assign (gcov_type_tmp_var, ref);
- gimple_assign_set_lhs (stmt1, make_ssa_name (gcov_type_tmp_var, stmt1));
+ gcov_type_tmp_var = make_temp_ssa_name (gcov_type_node,
+ NULL, "PROF_edge_counter");
stmt2 = gimple_build_assign_with_ops (PLUS_EXPR, gcov_type_tmp_var,
gimple_assign_lhs (stmt1), one);
- gimple_assign_set_lhs (stmt2, make_ssa_name (gcov_type_tmp_var, stmt2));
stmt3 = gimple_build_assign (unshare_expr (ref), gimple_assign_lhs (stmt2));
gsi_insert_on_edge (e, stmt1);
gsi_insert_on_edge (e, stmt2);
@@ -335,10 +332,9 @@ gimple_gen_ic_profiler (histogram_value value, unsigned tag, unsigned base)
stmt3: __gcov_indirect_call_callee = tmp1;
*/
- tmp1 = create_tmp_reg (ptr_void, "PROF");
stmt1 = gimple_build_assign (ic_gcov_type_ptr_var, ref_ptr);
+ tmp1 = make_temp_ssa_name (ptr_void, NULL, "PROF");
stmt2 = gimple_build_assign (tmp1, unshare_expr (value->hvalue.value));
- gimple_assign_set_lhs (stmt2, make_ssa_name (tmp1, stmt2));
stmt3 = gimple_build_assign (ic_void_ptr_var, gimple_assign_lhs (stmt2));
gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
@@ -481,9 +477,6 @@ tree_profiling (void)
push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl));
current_function_decl = node->symbol.decl;
- /* Re-set global shared temporary variable for edge-counters. */
- gcov_type_tmp_var = NULL_TREE;
-
/* Local pure-const may imply need to fixup the cfg. */
if (execute_fixup_cfg () & TODO_cleanup_cfg)
cleanup_tree_cfg ();
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 4d210ad896e..3c94b79dfef 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1448,18 +1448,15 @@ build_ref_for_offset (location_t loc, tree base, HOST_WIDE_INT offset,
tree tmp, addr;
gcc_checking_assert (gsi);
- tmp = create_tmp_reg (build_pointer_type (TREE_TYPE (prev_base)), NULL);
- tmp = make_ssa_name (tmp, NULL);
+ tmp = make_ssa_name (build_pointer_type (TREE_TYPE (prev_base)), NULL);
addr = build_fold_addr_expr (unshare_expr (prev_base));
STRIP_USELESS_TYPE_CONVERSION (addr);
stmt = gimple_build_assign (tmp, addr);
gimple_set_location (stmt, loc);
- SSA_NAME_DEF_STMT (tmp) = stmt;
if (insert_after)
gsi_insert_after (gsi, stmt, GSI_NEW_STMT);
else
gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
- update_stmt (stmt);
off = build_int_cst (reference_alias_ptr_type (prev_base),
offset / BITS_PER_UNIT);
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index c265f71bc93..649182ba7e2 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -1941,14 +1941,12 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi)
&& int_fits_type_p (arg2, TREE_TYPE (def1_arg1)))
{
gimple newop;
- tree tem = create_tmp_reg (TREE_TYPE (def1_arg1), NULL);
+ tree tem = make_ssa_name (TREE_TYPE (def1_arg1), NULL);
newop =
gimple_build_assign_with_ops (code, tem, def1_arg1,
fold_convert_loc (gimple_location (stmt),
TREE_TYPE (def1_arg1),
arg2));
- tem = make_ssa_name (tem, newop);
- gimple_assign_set_lhs (newop, tem);
gimple_set_location (newop, gimple_location (stmt));
gsi_insert_before (gsi, newop, GSI_SAME_STMT);
gimple_assign_set_rhs_with_ops_1 (gsi, NOP_EXPR,
@@ -1974,11 +1972,8 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi)
!= GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (arg1))))))
{
gimple newop;
- tree tem = create_tmp_reg (TREE_TYPE (def1_arg1),
- NULL);
+ tree tem = make_ssa_name (TREE_TYPE (def1_arg1), NULL);
newop = gimple_build_assign_with_ops (code, tem, def1_arg1, def2_arg1);
- tem = make_ssa_name (tem, newop);
- gimple_assign_set_lhs (newop, tem);
gimple_set_location (newop, gimple_location (stmt));
gsi_insert_before (gsi, newop, GSI_SAME_STMT);
gimple_assign_set_rhs_with_ops_1 (gsi, NOP_EXPR,
@@ -2020,10 +2015,8 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi)
{
gimple newop;
tree tem;
- tem = create_tmp_reg (TREE_TYPE (arg2), NULL);
+ tem = make_ssa_name (TREE_TYPE (arg2), NULL);
newop = gimple_build_assign_with_ops (code, tem, a, c);
- tem = make_ssa_name (tem, newop);
- gimple_assign_set_lhs (newop, tem);
gimple_set_location (newop, gimple_location (stmt));
/* Make sure to re-process the new stmt as it's walking upwards. */
gsi_insert_before (gsi, newop, GSI_NEW_STMT);
@@ -2051,11 +2044,9 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi)
update_stmt (stmt);
return true;
}
- tem = create_tmp_reg (TREE_TYPE (arg2), NULL);
+ tem = make_ssa_name (TREE_TYPE (arg2), NULL);
newop = gimple_build_assign_with_ops (BIT_AND_EXPR,
tem, def1_arg1, arg2);
- tem = make_ssa_name (tem, newop);
- gimple_assign_set_lhs (newop, tem);
gimple_set_location (newop, gimple_location (stmt));
/* Make sure to re-process the new stmt as it's walking upwards. */
gsi_insert_before (gsi, newop, GSI_NEW_STMT);
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 8894776ae8c..618233aa3ba 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -934,7 +934,7 @@ static gimple
rewrite_reciprocal (gimple_stmt_iterator *bsi)
{
gimple stmt, stmt1, stmt2;
- tree var, name, lhs, type;
+ tree name, lhs, type;
tree real_one;
gimple_stmt_iterator gsi;
@@ -942,14 +942,11 @@ rewrite_reciprocal (gimple_stmt_iterator *bsi)
lhs = gimple_assign_lhs (stmt);
type = TREE_TYPE (lhs);
- var = create_tmp_reg (type, "reciptmp");
-
real_one = build_one_cst (type);
- stmt1 = gimple_build_assign_with_ops (RDIV_EXPR,
- var, real_one, gimple_assign_rhs2 (stmt));
- name = make_ssa_name (var, stmt1);
- gimple_assign_set_lhs (stmt1, name);
+ name = make_temp_ssa_name (type, NULL, "reciptmp");
+ stmt1 = gimple_build_assign_with_ops (RDIV_EXPR, name, real_one,
+ gimple_assign_rhs2 (stmt));
stmt2 = gimple_build_assign_with_ops (MULT_EXPR, lhs, name,
gimple_assign_rhs1 (stmt));
@@ -972,7 +969,7 @@ static gimple
rewrite_bittest (gimple_stmt_iterator *bsi)
{
gimple stmt, use_stmt, stmt1, stmt2;
- tree lhs, var, name, t, a, b;
+ tree lhs, name, t, a, b;
use_operand_p use;
stmt = gsi_stmt (*bsi);
@@ -1021,18 +1018,15 @@ rewrite_bittest (gimple_stmt_iterator *bsi)
gimple_stmt_iterator rsi;
/* 1 << B */
- var = create_tmp_var (TREE_TYPE (a), "shifttmp");
t = fold_build2 (LSHIFT_EXPR, TREE_TYPE (a),
build_int_cst (TREE_TYPE (a), 1), b);
- stmt1 = gimple_build_assign (var, t);
- name = make_ssa_name (var, stmt1);
- gimple_assign_set_lhs (stmt1, name);
+ name = make_temp_ssa_name (TREE_TYPE (a), NULL, "shifttmp");
+ stmt1 = gimple_build_assign (name, t);
/* A & (1 << B) */
t = fold_build2 (BIT_AND_EXPR, TREE_TYPE (a), a, name);
- stmt2 = gimple_build_assign (var, t);
- name = make_ssa_name (var, stmt2);
- gimple_assign_set_lhs (stmt2, name);
+ name = make_temp_ssa_name (TREE_TYPE (a), NULL, "shifttmp");
+ stmt2 = gimple_build_assign (name, t);
/* Replace the SSA_NAME we compare against zero. Adjust
the type of zero accordingly. */
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index 288e7a2b45b..5aa8c7d3c3f 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -55,13 +55,18 @@ create_iv (tree base, tree step, tree var, struct loop *loop,
enum tree_code incr_op = PLUS_EXPR;
edge pe = loop_preheader_edge (loop);
- if (!var)
- var = create_tmp_var (TREE_TYPE (base), "ivtmp");
-
- vb = make_ssa_name (var, NULL);
+ if (var != NULL_TREE)
+ {
+ vb = make_ssa_name (var, NULL);
+ va = make_ssa_name (var, NULL);
+ }
+ else
+ {
+ vb = make_temp_ssa_name (TREE_TYPE (base), NULL, "ivtmp");
+ va = make_temp_ssa_name (TREE_TYPE (base), NULL, "ivtmp");
+ }
if (var_before)
*var_before = vb;
- va = make_ssa_name (var, NULL);
if (var_after)
*var_after = va;
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 2a37abe0f13..2eed792da01 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -740,9 +740,8 @@ execute_cse_sincos_1 (tree name)
fndecl = mathfn_built_in (type, BUILT_IN_CEXPI);
if (!fndecl)
return false;
- res = create_tmp_reg (TREE_TYPE (TREE_TYPE (fndecl)), "sincostmp");
stmt = gimple_build_call (fndecl, 1, name);
- res = make_ssa_name (res, stmt);
+ res = make_temp_ssa_name (TREE_TYPE (TREE_TYPE (fndecl)), stmt, "sincostmp");
gimple_call_set_lhs (stmt, res);
def_stmt = SSA_NAME_DEF_STMT (name);
@@ -758,7 +757,6 @@ execute_cse_sincos_1 (tree name)
gsi = gsi_after_labels (top_bb);
gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
}
- update_stmt (stmt);
sincos_stats.inserted++;
/* And adjust the recorded old call sites. */
@@ -939,7 +937,7 @@ powi_cost (HOST_WIDE_INT n)
static tree
powi_as_mults_1 (gimple_stmt_iterator *gsi, location_t loc, tree type,
- HOST_WIDE_INT n, tree *cache, tree target)
+ HOST_WIDE_INT n, tree *cache)
{
tree op0, op1, ssa_target;
unsigned HOST_WIDE_INT digit;
@@ -948,23 +946,23 @@ powi_as_mults_1 (gimple_stmt_iterator *gsi, location_t loc, tree type,
if (n < POWI_TABLE_SIZE && cache[n])
return cache[n];
- ssa_target = make_ssa_name (target, NULL);
+ ssa_target = make_temp_ssa_name (type, NULL, "powmult");
if (n < POWI_TABLE_SIZE)
{
cache[n] = ssa_target;
- op0 = powi_as_mults_1 (gsi, loc, type, n - powi_table[n], cache, target);
- op1 = powi_as_mults_1 (gsi, loc, type, powi_table[n], cache, target);
+ op0 = powi_as_mults_1 (gsi, loc, type, n - powi_table[n], cache);
+ op1 = powi_as_mults_1 (gsi, loc, type, powi_table[n], cache);
}
else if (n & 1)
{
digit = n & ((1 << POWI_WINDOW_SIZE) - 1);
- op0 = powi_as_mults_1 (gsi, loc, type, n - digit, cache, target);
- op1 = powi_as_mults_1 (gsi, loc, type, digit, cache, target);
+ op0 = powi_as_mults_1 (gsi, loc, type, n - digit, cache);
+ op1 = powi_as_mults_1 (gsi, loc, type, digit, cache);
}
else
{
- op0 = powi_as_mults_1 (gsi, loc, type, n >> 1, cache, target);
+ op0 = powi_as_mults_1 (gsi, loc, type, n >> 1, cache);
op1 = op0;
}
@@ -982,8 +980,9 @@ static tree
powi_as_mults (gimple_stmt_iterator *gsi, location_t loc,
tree arg0, HOST_WIDE_INT n)
{
- tree cache[POWI_TABLE_SIZE], result, type = TREE_TYPE (arg0), target;
+ tree cache[POWI_TABLE_SIZE], result, type = TREE_TYPE (arg0);
gimple div_stmt;
+ tree target;
if (n == 0)
return build_real (type, dconst1);
@@ -991,14 +990,12 @@ powi_as_mults (gimple_stmt_iterator *gsi, location_t loc,
memset (cache, 0, sizeof (cache));
cache[1] = arg0;
- target = create_tmp_reg (type, "powmult");
- result = powi_as_mults_1 (gsi, loc, type, (n < 0) ? -n : n, cache, target);
-
+ result = powi_as_mults_1 (gsi, loc, type, (n < 0) ? -n : n, cache);
if (n >= 0)
return result;
/* If the original exponent was negative, reciprocate the result. */
- target = make_ssa_name (target, NULL);
+ target = make_temp_ssa_name (type, NULL, "powmult");
div_stmt = gimple_build_assign_with_ops (RDIV_EXPR, target,
build_real (type, dconst1),
result);
@@ -1029,23 +1026,19 @@ gimple_expand_builtin_powi (gimple_stmt_iterator *gsi, location_t loc,
}
/* Build a gimple call statement that calls FN with argument ARG.
- Set the lhs of the call statement to a fresh SSA name for
- variable VAR. If VAR is NULL, first allocate it. Insert the
+ Set the lhs of the call statement to a fresh SSA name. Insert the
statement prior to GSI's current position, and return the fresh
SSA name. */
static tree
build_and_insert_call (gimple_stmt_iterator *gsi, location_t loc,
- tree *var, tree fn, tree arg)
+ tree fn, tree arg)
{
gimple call_stmt;
tree ssa_target;
- if (!*var)
- *var = create_tmp_reg (TREE_TYPE (arg), "powroot");
-
call_stmt = gimple_build_call (fn, 1, arg);
- ssa_target = make_ssa_name (*var, NULL);
+ ssa_target = make_temp_ssa_name (TREE_TYPE (arg), NULL, "powroot");
gimple_set_lhs (call_stmt, ssa_target);
gimple_set_location (call_stmt, loc);
gsi_insert_before (gsi, call_stmt, GSI_SAME_STMT);
@@ -1060,9 +1053,10 @@ build_and_insert_call (gimple_stmt_iterator *gsi, location_t loc,
static tree
build_and_insert_binop (gimple_stmt_iterator *gsi, location_t loc,
- tree target, enum tree_code code, tree arg0, tree arg1)
+ const char *name, enum tree_code code,
+ tree arg0, tree arg1)
{
- tree result = make_ssa_name (target, NULL);
+ tree result = make_temp_ssa_name (TREE_TYPE (arg0), NULL, name);
gimple stmt = gimple_build_assign_with_ops (code, result, arg0, arg1);
gimple_set_location (stmt, loc);
gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
@@ -1070,29 +1064,33 @@ build_and_insert_binop (gimple_stmt_iterator *gsi, location_t loc,
}
/* Build a gimple reference operation with the given CODE and argument
- ARG, assigning the result to a new SSA name for variable TARGET.
+ ARG, assigning the result to a new SSA name of TYPE with NAME.
Insert the statement prior to GSI's current position, and return
the fresh SSA name. */
static inline tree
build_and_insert_ref (gimple_stmt_iterator *gsi, location_t loc, tree type,
- tree target, enum tree_code code, tree arg0)
+ const char *name, enum tree_code code, tree arg0)
{
- tree result = make_ssa_name (target, NULL);
+ tree result = make_temp_ssa_name (type, NULL, name);
gimple stmt = gimple_build_assign (result, build1 (code, type, arg0));
gimple_set_location (stmt, loc);
gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
return result;
}
-/* Build a gimple assignment to cast VAL to TARGET. Insert the statement
+/* Build a gimple assignment to cast VAL to TYPE. Insert the statement
prior to GSI's current position, and return the fresh SSA name. */
static tree
build_and_insert_cast (gimple_stmt_iterator *gsi, location_t loc,
- tree target, tree val)
+ tree type, tree val)
{
- return build_and_insert_binop (gsi, loc, target, CONVERT_EXPR, val, NULL);
+ tree result = make_ssa_name (type, NULL);
+ gimple stmt = gimple_build_assign_with_ops (NOP_EXPR, result, val, NULL_TREE);
+ gimple_set_location (stmt, loc);
+ gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
+ return result;
}
/* ARG0 and ARG1 are the two arguments to a pow builtin call in GSI
@@ -1108,7 +1106,6 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
REAL_VALUE_TYPE c2, dconst3;
HOST_WIDE_INT n;
tree type, sqrtfn, cbrtfn, sqrt_arg0, sqrt_sqrt, result, cbrt_x, powi_cbrt_x;
- tree target = NULL_TREE;
enum machine_mode mode;
bool hw_sqrt_exists;
@@ -1141,7 +1138,7 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
if (sqrtfn
&& REAL_VALUES_EQUAL (c, dconsthalf)
&& !HONOR_SIGNED_ZEROS (mode))
- return build_and_insert_call (gsi, loc, &target, sqrtfn, arg0);
+ return build_and_insert_call (gsi, loc, sqrtfn, arg0);
/* Optimize pow(x,0.25) = sqrt(sqrt(x)). Assume on most machines that
a builtin sqrt instruction is smaller than a call to pow with 0.25,
@@ -1157,10 +1154,10 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
&& hw_sqrt_exists)
{
/* sqrt(x) */
- sqrt_arg0 = build_and_insert_call (gsi, loc, &target, sqrtfn, arg0);
+ sqrt_arg0 = build_and_insert_call (gsi, loc, sqrtfn, arg0);
/* sqrt(sqrt(x)) */
- return build_and_insert_call (gsi, loc, &target, sqrtfn, sqrt_arg0);
+ return build_and_insert_call (gsi, loc, sqrtfn, sqrt_arg0);
}
/* Optimize pow(x,0.75) = sqrt(x) * sqrt(sqrt(x)) unless we are
@@ -1176,13 +1173,13 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
&& hw_sqrt_exists)
{
/* sqrt(x) */
- sqrt_arg0 = build_and_insert_call (gsi, loc, &target, sqrtfn, arg0);
+ sqrt_arg0 = build_and_insert_call (gsi, loc, sqrtfn, arg0);
/* sqrt(sqrt(x)) */
- sqrt_sqrt = build_and_insert_call (gsi, loc, &target, sqrtfn, sqrt_arg0);
+ sqrt_sqrt = build_and_insert_call (gsi, loc, sqrtfn, sqrt_arg0);
/* sqrt(x) * sqrt(sqrt(x)) */
- return build_and_insert_binop (gsi, loc, target, MULT_EXPR,
+ return build_and_insert_binop (gsi, loc, "powroot", MULT_EXPR,
sqrt_arg0, sqrt_sqrt);
}
@@ -1199,7 +1196,7 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
&& cbrtfn
&& (gimple_val_nonnegative_real_p (arg0) || !HONOR_NANS (mode))
&& REAL_VALUES_EQUAL (c, dconst1_3))
- return build_and_insert_call (gsi, loc, &target, cbrtfn, arg0);
+ return build_and_insert_call (gsi, loc, cbrtfn, arg0);
/* Optimize pow(x,1./6.) = cbrt(sqrt(x)). Don't do this optimization
if we don't have a hardware sqrt insn. */
@@ -1215,10 +1212,10 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
&& REAL_VALUES_EQUAL (c, dconst1_6))
{
/* sqrt(x) */
- sqrt_arg0 = build_and_insert_call (gsi, loc, &target, sqrtfn, arg0);
+ sqrt_arg0 = build_and_insert_call (gsi, loc, sqrtfn, arg0);
/* cbrt(sqrt(x)) */
- return build_and_insert_call (gsi, loc, &target, cbrtfn, sqrt_arg0);
+ return build_and_insert_call (gsi, loc, cbrtfn, sqrt_arg0);
}
/* Optimize pow(x,c), where n = 2c for some nonzero integer n, into
@@ -1250,17 +1247,17 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
/* Calculate sqrt(x). When n is not 1 or -1, multiply it by the
result of the optimal multiply sequence just calculated. */
- sqrt_arg0 = build_and_insert_call (gsi, loc, &target, sqrtfn, arg0);
+ sqrt_arg0 = build_and_insert_call (gsi, loc, sqrtfn, arg0);
if (absu_hwi (n) == 1)
result = sqrt_arg0;
else
- result = build_and_insert_binop (gsi, loc, target, MULT_EXPR,
+ result = build_and_insert_binop (gsi, loc, "powroot", MULT_EXPR,
sqrt_arg0, powi_x_ndiv2);
/* If n is negative, reciprocate the result. */
if (n < 0)
- result = build_and_insert_binop (gsi, loc, target, RDIV_EXPR,
+ result = build_and_insert_binop (gsi, loc, "powroot", RDIV_EXPR,
build_real (type, dconst1), result);
return result;
}
@@ -1305,24 +1302,24 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
/* Calculate powi(cbrt(x), n%3). Don't use gimple_expand_builtin_powi
as that creates an unnecessary variable. Instead, just produce
either cbrt(x) or cbrt(x) * cbrt(x). */
- cbrt_x = build_and_insert_call (gsi, loc, &target, cbrtfn, arg0);
+ cbrt_x = build_and_insert_call (gsi, loc, cbrtfn, arg0);
if (absu_hwi (n) % 3 == 1)
powi_cbrt_x = cbrt_x;
else
- powi_cbrt_x = build_and_insert_binop (gsi, loc, target, MULT_EXPR,
+ powi_cbrt_x = build_and_insert_binop (gsi, loc, "powroot", MULT_EXPR,
cbrt_x, cbrt_x);
/* Multiply the two subexpressions, unless powi(x,abs(n)/3) = 1. */
if (absu_hwi (n) < 3)
result = powi_cbrt_x;
else
- result = build_and_insert_binop (gsi, loc, target, MULT_EXPR,
+ result = build_and_insert_binop (gsi, loc, "powroot", MULT_EXPR,
powi_x_ndiv3, powi_cbrt_x);
/* If n is negative, reciprocate the result. */
if (n < 0)
- result = build_and_insert_binop (gsi, loc, target, RDIV_EXPR,
+ result = build_and_insert_binop (gsi, loc, "powroot", RDIV_EXPR,
build_real (type, dconst1), result);
return result;
@@ -1340,7 +1337,7 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
static tree
gimple_expand_builtin_cabs (gimple_stmt_iterator *gsi, location_t loc, tree arg)
{
- tree target, real_part, imag_part, addend1, addend2, sum, result;
+ tree real_part, imag_part, addend1, addend2, sum, result;
tree type = TREE_TYPE (TREE_TYPE (arg));
tree sqrtfn = mathfn_built_in (type, BUILT_IN_SQRT);
enum machine_mode mode = TYPE_MODE (type);
@@ -1351,17 +1348,16 @@ gimple_expand_builtin_cabs (gimple_stmt_iterator *gsi, location_t loc, tree arg)
|| optab_handler (sqrt_optab, mode) == CODE_FOR_nothing)
return NULL_TREE;
- target = create_tmp_reg (type, "cabs");
- real_part = build_and_insert_ref (gsi, loc, type, target,
+ real_part = build_and_insert_ref (gsi, loc, type, "cabs",
REALPART_EXPR, arg);
- addend1 = build_and_insert_binop (gsi, loc, target, MULT_EXPR,
+ addend1 = build_and_insert_binop (gsi, loc, "cabs", MULT_EXPR,
real_part, real_part);
- imag_part = build_and_insert_ref (gsi, loc, type, target,
+ imag_part = build_and_insert_ref (gsi, loc, type, "cabs",
IMAGPART_EXPR, arg);
- addend2 = build_and_insert_binop (gsi, loc, target, MULT_EXPR,
+ addend2 = build_and_insert_binop (gsi, loc, "cabs", MULT_EXPR,
imag_part, imag_part);
- sum = build_and_insert_binop (gsi, loc, target, PLUS_EXPR, addend1, addend2);
- result = build_and_insert_call (gsi, loc, &target, sqrtfn, sum);
+ sum = build_and_insert_binop (gsi, loc, "cabs", PLUS_EXPR, addend1, addend2);
+ result = build_and_insert_call (gsi, loc, sqrtfn, sum);
return result;
}
@@ -1894,12 +1890,9 @@ execute_optimize_bswap (void)
if (!useless_type_conversion_p (TREE_TYPE (bswap_tmp), bswap_type))
{
gimple convert_stmt;
-
- bswap_tmp = create_tmp_var (bswap_type, "bswapsrc");
- bswap_tmp = make_ssa_name (bswap_tmp, NULL);
-
- convert_stmt = gimple_build_assign_with_ops (
- CONVERT_EXPR, bswap_tmp, bswap_src, NULL);
+ bswap_tmp = make_temp_ssa_name (bswap_type, NULL, "bswapsrc");
+ convert_stmt = gimple_build_assign_with_ops
+ (NOP_EXPR, bswap_tmp, bswap_src, NULL);
gsi_insert_before (&gsi, convert_stmt, GSI_SAME_STMT);
}
@@ -1911,11 +1904,9 @@ execute_optimize_bswap (void)
if (!useless_type_conversion_p (TREE_TYPE (bswap_tmp), bswap_type))
{
gimple convert_stmt;
-
- bswap_tmp = create_tmp_var (bswap_type, "bswapdst");
- bswap_tmp = make_ssa_name (bswap_tmp, NULL);
- convert_stmt = gimple_build_assign_with_ops (
- CONVERT_EXPR, gimple_assign_lhs (stmt), bswap_tmp, NULL);
+ bswap_tmp = make_temp_ssa_name (bswap_type, NULL, "bswapdst");
+ convert_stmt = gimple_build_assign_with_ops
+ (NOP_EXPR, gimple_assign_lhs (stmt), bswap_tmp, NULL);
gsi_insert_after (&gsi, convert_stmt, GSI_SAME_STMT);
}
@@ -2092,7 +2083,7 @@ is_widening_mult_p (gimple stmt,
static bool
convert_mult_to_widen (gimple stmt, gimple_stmt_iterator *gsi)
{
- tree lhs, rhs1, rhs2, type, type1, type2, tmp = NULL;
+ tree lhs, rhs1, rhs2, type, type1, type2;
enum insn_code handler;
enum machine_mode to_mode, from_mode, actual_mode;
optab op;
@@ -2161,22 +2152,14 @@ convert_mult_to_widen (gimple stmt, gimple_stmt_iterator *gsi)
return false;
if (actual_precision != TYPE_PRECISION (type1)
|| from_unsigned1 != TYPE_UNSIGNED (type1))
- {
- tmp = create_tmp_var (build_nonstandard_integer_type
- (actual_precision, from_unsigned1),
- NULL);
- rhs1 = build_and_insert_cast (gsi, loc, tmp, rhs1);
- }
+ rhs1 = build_and_insert_cast (gsi, loc,
+ build_nonstandard_integer_type
+ (actual_precision, from_unsigned1), rhs1);
if (actual_precision != TYPE_PRECISION (type2)
|| from_unsigned2 != TYPE_UNSIGNED (type2))
- {
- /* Reuse the same type info, if possible. */
- if (!tmp || from_unsigned1 != from_unsigned2)
- tmp = create_tmp_var (build_nonstandard_integer_type
- (actual_precision, from_unsigned2),
- NULL);
- rhs2 = build_and_insert_cast (gsi, loc, tmp, rhs2);
- }
+ rhs2 = build_and_insert_cast (gsi, loc,
+ build_nonstandard_integer_type
+ (actual_precision, from_unsigned2), rhs2);
/* Handle constants. */
if (TREE_CODE (rhs1) == INTEGER_CST)
@@ -2204,7 +2187,7 @@ convert_plusminus_to_widen (gimple_stmt_iterator *gsi, gimple stmt,
{
gimple rhs1_stmt = NULL, rhs2_stmt = NULL;
gimple conv1_stmt = NULL, conv2_stmt = NULL, conv_stmt;
- tree type, type1, type2, optype, tmp = NULL;
+ tree type, type1, type2, optype;
tree lhs, rhs1, rhs2, mult_rhs1, mult_rhs2, add_rhs;
enum tree_code rhs1_code = ERROR_MARK, rhs2_code = ERROR_MARK;
optab this_optab;
@@ -2373,25 +2356,19 @@ convert_plusminus_to_widen (gimple_stmt_iterator *gsi, gimple stmt,
actual_precision = GET_MODE_PRECISION (actual_mode);
if (actual_precision != TYPE_PRECISION (type1)
|| from_unsigned1 != TYPE_UNSIGNED (type1))
- {
- tmp = create_tmp_var (build_nonstandard_integer_type
- (actual_precision, from_unsigned1),
- NULL);
- mult_rhs1 = build_and_insert_cast (gsi, loc, tmp, mult_rhs1);
- }
+ mult_rhs1 = build_and_insert_cast (gsi, loc,
+ build_nonstandard_integer_type
+ (actual_precision, from_unsigned1),
+ mult_rhs1);
if (actual_precision != TYPE_PRECISION (type2)
|| from_unsigned2 != TYPE_UNSIGNED (type2))
- {
- if (!tmp || from_unsigned1 != from_unsigned2)
- tmp = create_tmp_var (build_nonstandard_integer_type
- (actual_precision, from_unsigned2),
- NULL);
- mult_rhs2 = build_and_insert_cast (gsi, loc, tmp, mult_rhs2);
- }
+ mult_rhs2 = build_and_insert_cast (gsi, loc,
+ build_nonstandard_integer_type
+ (actual_precision, from_unsigned2),
+ mult_rhs2);
if (!useless_type_conversion_p (type, TREE_TYPE (add_rhs)))
- add_rhs = build_and_insert_cast (gsi, loc, create_tmp_var (type, NULL),
- add_rhs);
+ add_rhs = build_and_insert_cast (gsi, loc, type, add_rhs);
/* Handle constants. */
if (TREE_CODE (mult_rhs1) == INTEGER_CST)
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index c7af5e7eccc..05166eb8c90 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -272,10 +272,6 @@ single_non_singleton_phi_for_edges (gimple_seq seq, edge e0, edge e1)
return phi;
}
-/* For conditional store replacement we need a temporary to
- put the old contents of the memory in. */
-static tree condstoretemp;
-
/* The core routine of conditional store replacement and normal
phi optimizations. Both share much of the infrastructure in how
to match applicable basic block patterns. DO_STORE_ELIM is true
@@ -292,11 +288,8 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads)
struct pointer_set_t *nontrap = 0;
if (do_store_elim)
- {
- condstoretemp = NULL_TREE;
- /* Calculate the set of non-trapping memory accesses. */
- nontrap = get_non_trapping ();
- }
+ /* Calculate the set of non-trapping memory accesses. */
+ nontrap = get_non_trapping ();
/* Search every basic block for COND_EXPR we may be able to optimize.
@@ -690,11 +683,9 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
{
source_location locus_0, locus_1;
- new_var2 = create_tmp_var (TREE_TYPE (result), NULL);
+ new_var2 = make_ssa_name (TREE_TYPE (result), NULL);
new_stmt = gimple_build_assign_with_ops (CONVERT_EXPR, new_var2,
new_var, NULL);
- new_var2 = make_ssa_name (new_var2, new_stmt);
- gimple_assign_set_lhs (new_stmt, new_var2);
gsi_insert_before (&gsi, new_stmt, GSI_SAME_STMT);
new_var = new_var2;
@@ -1212,10 +1203,7 @@ abs_replacement (basic_block cond_bb, basic_block middle_bb,
result = duplicate_ssa_name (result, NULL);
if (negate)
- {
- tree tmp = create_tmp_var (TREE_TYPE (result), NULL);
- lhs = make_ssa_name (tmp, NULL);
- }
+ lhs = make_ssa_name (TREE_TYPE (result), NULL);
else
lhs = result;
@@ -1445,7 +1433,7 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
edge e0, edge e1, struct pointer_set_t *nontrap)
{
gimple assign = last_and_only_stmt (middle_bb);
- tree lhs, rhs, name;
+ tree lhs, rhs, name, name2;
gimple newphi, new_stmt;
gimple_stmt_iterator gsi;
source_location locus;
@@ -1476,31 +1464,26 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
gsi_remove (&gsi, true);
release_defs (assign);
- /* 2) Create a temporary where we can store the old content
- of the memory touched by the store, if we need to. */
- if (!condstoretemp || TREE_TYPE (lhs) != TREE_TYPE (condstoretemp))
- condstoretemp = create_tmp_reg (TREE_TYPE (lhs), "cstore");
-
- /* 3) Insert a load from the memory of the store to the temporary
+ /* 2) Insert a load from the memory of the store to the temporary
on the edge which did not contain the store. */
lhs = unshare_expr (lhs);
- new_stmt = gimple_build_assign (condstoretemp, lhs);
- name = make_ssa_name (condstoretemp, new_stmt);
- gimple_assign_set_lhs (new_stmt, name);
+ name = make_temp_ssa_name (TREE_TYPE (lhs), NULL, "cstore");
+ new_stmt = gimple_build_assign (name, lhs);
gimple_set_location (new_stmt, locus);
gsi_insert_on_edge (e1, new_stmt);
- /* 4) Create a PHI node at the join block, with one argument
+ /* 3) Create a PHI node at the join block, with one argument
holding the old RHS, and the other holding the temporary
where we stored the old memory contents. */
- newphi = create_phi_node (condstoretemp, join_bb);
+ name2 = make_temp_ssa_name (TREE_TYPE (lhs), NULL, "cstore");
+ newphi = create_phi_node (name2, join_bb);
add_phi_arg (newphi, rhs, e0, locus);
add_phi_arg (newphi, name, e1, locus);
lhs = unshare_expr (lhs);
new_stmt = gimple_build_assign (lhs, PHI_RESULT (newphi));
- /* 5) Insert that PHI node. */
+ /* 4) Insert that PHI node. */
gsi = gsi_after_labels (join_bb);
if (gsi_end_p (gsi))
{
@@ -1520,7 +1503,7 @@ cond_if_else_store_replacement_1 (basic_block then_bb, basic_block else_bb,
basic_block join_bb, gimple then_assign,
gimple else_assign)
{
- tree lhs_base, lhs, then_rhs, else_rhs;
+ tree lhs_base, lhs, then_rhs, else_rhs, name;
source_location then_locus, else_locus;
gimple_stmt_iterator gsi;
gimple newphi, new_stmt;
@@ -1560,21 +1543,17 @@ cond_if_else_store_replacement_1 (basic_block then_bb, basic_block else_bb,
gsi_remove (&gsi, true);
release_defs (else_assign);
- /* 2) Create a temporary where we can store the old content
- of the memory touched by the store, if we need to. */
- if (!condstoretemp || TREE_TYPE (lhs) != TREE_TYPE (condstoretemp))
- condstoretemp = create_tmp_reg (TREE_TYPE (lhs), "cstore");
-
- /* 3) Create a PHI node at the join block, with one argument
+ /* 2) Create a PHI node at the join block, with one argument
holding the old RHS, and the other holding the temporary
where we stored the old memory contents. */
- newphi = create_phi_node (condstoretemp, join_bb);
+ name = make_temp_ssa_name (TREE_TYPE (lhs), NULL, "cstore");
+ newphi = create_phi_node (name, join_bb);
add_phi_arg (newphi, then_rhs, EDGE_SUCC (then_bb, 0), then_locus);
add_phi_arg (newphi, else_rhs, EDGE_SUCC (else_bb, 0), else_locus);
new_stmt = gimple_build_assign (lhs, PHI_RESULT (newphi));
- /* 4) Insert that PHI node. */
+ /* 3) Insert that PHI node. */
gsi = gsi_after_labels (join_bb);
if (gsi_end_p (gsi))
{
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index cc2b89364c9..2f0b3bb9b83 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -186,7 +186,7 @@ phiprop_insert_phi (basic_block bb, gimple phi, gimple use_stmt,
{
tree rhs = gimple_assign_rhs1 (use_stmt);
gcc_assert (TREE_CODE (old_arg) == ADDR_EXPR);
- new_var = create_tmp_reg (TREE_TYPE (rhs), NULL);
+ new_var = make_ssa_name (TREE_TYPE (rhs), NULL);
if (!is_gimple_min_invariant (old_arg))
old_arg = PHI_ARG_DEF_FROM_EDGE (phi, e);
else
@@ -195,9 +195,6 @@ phiprop_insert_phi (basic_block bb, gimple phi, gimple use_stmt,
fold_build2 (MEM_REF, TREE_TYPE (rhs),
old_arg,
TREE_OPERAND (rhs, 1)));
- gcc_assert (is_gimple_reg (new_var));
- new_var = make_ssa_name (new_var, tmp);
- gimple_assign_set_lhs (tmp, new_var);
gimple_set_location (tmp, locus);
gsi_insert_on_edge (e, tmp);
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 8c5bc6b9fcc..6264b54eebd 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -472,14 +472,6 @@ static unsigned int get_expr_value_id (pre_expr);
static alloc_pool bitmap_set_pool;
static bitmap_obstack grand_bitmap_obstack;
-/* To avoid adding 300 temporary variables when we only need one, we
- only create one temporary variable, on demand, and build ssa names
- off that. We do have to change the variable if the types don't
- match the current variable's type. */
-static tree pretemp;
-static tree storetemp;
-static tree prephitemp;
-
/* Set of blocks with statements that have had their EH properties changed. */
static bitmap need_eh_cleanup;
@@ -1366,7 +1358,6 @@ get_expr_type (const pre_expr e)
static tree
get_representative_for (const pre_expr e)
{
- tree exprtype;
tree name;
unsigned int value_id = get_expr_value_id (e);
@@ -1406,14 +1397,9 @@ get_representative_for (const pre_expr e)
fprintf (dump_file, "\n");
}
- exprtype = get_expr_type (e);
-
/* Build and insert the assignment of the end result to the temporary
that we will return. */
- if (!pretemp || exprtype != TREE_TYPE (pretemp))
- pretemp = create_tmp_reg (exprtype, "pretmp");
-
- name = make_ssa_name (pretemp, gimple_build_nop ());
+ name = make_temp_ssa_name (get_expr_type (e), gimple_build_nop (), "pretmp");
VN_INFO_GET (name)->value_id = value_id;
if (e->kind == CONSTANT)
VN_INFO (name)->valnum = PRE_EXPR_CONSTANT (e);
@@ -2602,11 +2588,6 @@ can_PRE_operation (tree op)
that didn't turn out to be necessary. */
static bitmap inserted_exprs;
-/* Pool allocated fake store expressions are placed onto this
- worklist, which, after performing dead code elimination, is walked
- to see which expressions need to be put into GC'able memory */
-static VEC(gimple, heap) *need_creation;
-
/* The actual worker for create_component_ref_by_pieces. */
static tree
@@ -2983,7 +2964,7 @@ static tree
create_expression_by_pieces (basic_block block, pre_expr expr,
gimple_seq *stmts, gimple domstmt, tree type)
{
- tree temp, name;
+ tree name;
tree folded;
gimple_seq forced_stmts = NULL;
unsigned int value_id;
@@ -3101,16 +3082,8 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
gimple_seq_add_seq (stmts, forced_stmts);
}
- /* Build and insert the assignment of the end result to the temporary
- that we will return. */
- if (!pretemp || exprtype != TREE_TYPE (pretemp))
- pretemp = create_tmp_reg (exprtype, "pretmp");
-
- temp = pretemp;
-
- newstmt = gimple_build_assign (temp, folded);
- name = make_ssa_name (temp, newstmt);
- gimple_assign_set_lhs (newstmt, name);
+ name = make_temp_ssa_name (exprtype, NULL, "pretmp");
+ newstmt = gimple_build_assign (name, folded);
gimple_set_plf (newstmt, NECESSARY, false);
gimple_seq_add_stmt (stmts, newstmt);
@@ -3361,14 +3334,7 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
return false;
/* Now build a phi for the new variable. */
- if (!prephitemp || TREE_TYPE (prephitemp) != type)
- prephitemp = create_tmp_var (type, "prephitmp");
-
- temp = prephitemp;
-
- if (TREE_CODE (type) == COMPLEX_TYPE
- || TREE_CODE (type) == VECTOR_TYPE)
- DECL_GIMPLE_REG_P (temp) = 1;
+ temp = make_temp_ssa_name (type, NULL, "prephitmp");
phi = create_phi_node (temp, block);
gimple_set_plf (phi, NECESSARY, false);
@@ -4809,10 +4775,6 @@ init_pre (bool do_fre)
in_fre = do_fre;
inserted_exprs = BITMAP_ALLOC (NULL);
- need_creation = NULL;
- pretemp = NULL_TREE;
- storetemp = NULL_TREE;
- prephitemp = NULL_TREE;
connect_infinite_loops_to_exit ();
memset (&pre_stats, 0, sizeof (pre_stats));
@@ -4860,7 +4822,6 @@ fini_pre (bool do_fre)
free (postorder);
VEC_free (bitmap_set_t, heap, value_expressions);
BITMAP_FREE (inserted_exprs);
- VEC_free (gimple, heap, need_creation);
bitmap_obstack_release (&grand_bitmap_obstack);
free_alloc_pool (bitmap_set_pool);
free_alloc_pool (pre_expr_pool);
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index cd58ab215e1..f5643b619a9 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -791,11 +791,11 @@ update_call_from_tree (gimple_stmt_iterator *si_p, tree expr)
variable. Create an assignment statement
with a dummy (unused) lhs variable. */
STRIP_USELESS_TYPE_CONVERSION (expr);
- lhs = create_tmp_var (TREE_TYPE (expr), NULL);
- new_stmt = gimple_build_assign (lhs, expr);
if (gimple_in_ssa_p (cfun))
- lhs = make_ssa_name (lhs, new_stmt);
- gimple_assign_set_lhs (new_stmt, lhs);
+ lhs = make_ssa_name (TREE_TYPE (expr), NULL);
+ else
+ lhs = create_tmp_var (TREE_TYPE (expr), NULL);
+ new_stmt = gimple_build_assign (lhs, expr);
gimple_set_vuse (new_stmt, gimple_vuse (stmt));
gimple_set_vdef (new_stmt, gimple_vdef (stmt));
move_ssa_defining_stmt_for_defs (new_stmt, stmt);
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 5b301f6df8b..233ecce59bd 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -1147,7 +1147,7 @@ zero_one_operation (tree *def, enum tree_code opcode, tree op)
OP1 or OP2. Returns the new statement. */
static gimple
-build_and_add_sum (tree tmpvar, tree op1, tree op2, enum tree_code opcode)
+build_and_add_sum (tree type, tree op1, tree op2, enum tree_code opcode)
{
gimple op1def = NULL, op2def = NULL;
gimple_stmt_iterator gsi;
@@ -1155,9 +1155,8 @@ build_and_add_sum (tree tmpvar, tree op1, tree op2, enum tree_code opcode)
gimple sum;
/* Create the addition statement. */
- sum = gimple_build_assign_with_ops (opcode, tmpvar, op1, op2);
- op = make_ssa_name (tmpvar, sum);
- gimple_assign_set_lhs (sum, op);
+ op = make_ssa_name (type, NULL);
+ sum = gimple_build_assign_with_ops (opcode, op, op1, op2);
/* Find an insertion place and insert. */
if (TREE_CODE (op1) == SSA_NAME)
@@ -1421,7 +1420,6 @@ undistribute_ops_list (enum tree_code opcode,
if (nr_candidates2 >= 2)
{
operand_entry_t oe1, oe2;
- tree tmpvar;
gimple prod;
int first = sbitmap_first_set_bit (candidates2);
@@ -1432,7 +1430,6 @@ undistribute_ops_list (enum tree_code opcode,
fprintf (dump_file, "Building (");
print_generic_expr (dump_file, oe1->op, 0);
}
- tmpvar = create_tmp_reg (TREE_TYPE (oe1->op), NULL);
zero_one_operation (&oe1->op, c->oecode, c->op);
EXECUTE_IF_SET_IN_SBITMAP (candidates2, first+1, i, sbi0)
{
@@ -1444,14 +1441,16 @@ undistribute_ops_list (enum tree_code opcode,
print_generic_expr (dump_file, oe2->op, 0);
}
zero_one_operation (&oe2->op, c->oecode, c->op);
- sum = build_and_add_sum (tmpvar, oe1->op, oe2->op, opcode);
+ sum = build_and_add_sum (TREE_TYPE (oe1->op),
+ oe1->op, oe2->op, opcode);
oe2->op = build_zero_cst (TREE_TYPE (oe2->op));
oe2->rank = 0;
oe1->op = gimple_get_lhs (sum);
}
/* Apply the multiplication/division. */
- prod = build_and_add_sum (tmpvar, oe1->op, c->op, c->oecode);
+ prod = build_and_add_sum (TREE_TYPE (oe1->op),
+ oe1->op, c->op, c->oecode);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, ") %s ", c->oecode == MULT_EXPR ? "*" : "/");
@@ -1590,19 +1589,17 @@ eliminate_redundant_comparison (enum tree_code opcode,
}
else if (!operand_equal_p (t, curr->op, 0))
{
- tree tmpvar;
gimple sum;
enum tree_code subcode;
tree newop1;
tree newop2;
gcc_assert (COMPARISON_CLASS_P (t));
- tmpvar = create_tmp_var (TREE_TYPE (t), NULL);
extract_ops_from_tree (t, &subcode, &newop1, &newop2);
STRIP_USELESS_TYPE_CONVERSION (newop1);
STRIP_USELESS_TYPE_CONVERSION (newop2);
gcc_checking_assert (is_gimple_val (newop1)
&& is_gimple_val (newop2));
- sum = build_and_add_sum (tmpvar, newop1, newop2, subcode);
+ sum = build_and_add_sum (TREE_TYPE (t), newop1, newop2, subcode);
curr->op = gimple_get_lhs (sum);
}
return true;
@@ -2442,7 +2439,6 @@ rewrite_expr_tree_parallel (gimple stmt, int width,
int ready_stmts_end = 0;
int i = 0;
tree last_rhs1 = gimple_assign_rhs1 (stmt);
- tree lhs_var;
/* We start expression rewriting from the top statements.
So, in this loop we create a full list of statements
@@ -2451,8 +2447,6 @@ rewrite_expr_tree_parallel (gimple stmt, int width,
for (i = stmt_num - 2; i >= 0; i--)
stmts[i] = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmts[i+1]));
- lhs_var = create_tmp_reg (TREE_TYPE (last_rhs1), NULL);
-
for (i = 0; i < stmt_num; i++)
{
tree op1, op2;
@@ -2511,7 +2505,7 @@ rewrite_expr_tree_parallel (gimple stmt, int width,
update_stmt (stmts[i]);
}
else
- stmts[i] = build_and_add_sum (lhs_var, op1, op2, opcode);
+ stmts[i] = build_and_add_sum (TREE_TYPE (last_rhs1), op1, op2, opcode);
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -3075,27 +3069,13 @@ compare_repeat_factors (const void *x1, const void *x2)
return rf2->rank - rf1->rank;
}
-/* Get a new SSA name for register variable *TARGET of type TYPE.
- If *TARGET is null or incompatible with TYPE, create the variable
- first. */
-
-static tree
-get_reassoc_pow_ssa_name (tree *target, tree type)
-{
- if (!*target || !types_compatible_p (type, TREE_TYPE (*target)))
- *target = create_tmp_reg (type, "reassocpow");
-
- return make_ssa_name (*target, NULL);
-}
-
/* Look for repeated operands in OPS in the multiply tree rooted at
STMT. Replace them with an optimal sequence of multiplies and powi
builtin calls, and remove the used operands from OPS. Return an
SSA name representing the value of the replacement sequence. */
static tree
-attempt_builtin_powi (gimple stmt, VEC(operand_entry_t, heap) **ops,
- tree *target)
+attempt_builtin_powi (gimple stmt, VEC(operand_entry_t, heap) **ops)
{
unsigned i, j, vec_len;
int ii;
@@ -3220,7 +3200,7 @@ attempt_builtin_powi (gimple stmt, VEC(operand_entry_t, heap) **ops,
}
else
{
- iter_result = get_reassoc_pow_ssa_name (target, type);
+ iter_result = make_temp_ssa_name (type, NULL, "reassocpow");
pow_stmt = gimple_build_call (powi_fndecl, 2, rf1->repr,
build_int_cst (integer_type_node,
power));
@@ -3305,7 +3285,7 @@ attempt_builtin_powi (gimple stmt, VEC(operand_entry_t, heap) **ops,
op1 = rf1->factor;
op2 = rf2->repr;
- target_ssa = get_reassoc_pow_ssa_name (target, type);
+ target_ssa = make_temp_ssa_name (type, NULL, "reassocpow");
mul_stmt = gimple_build_assign_with_ops (MULT_EXPR,
target_ssa,
op1, op2);
@@ -3321,7 +3301,7 @@ attempt_builtin_powi (gimple stmt, VEC(operand_entry_t, heap) **ops,
/* Form a call to __builtin_powi for the maximum product
just formed, raised to the power obtained earlier. */
rf1 = VEC_index (repeat_factor, repeat_factor_vec, j);
- iter_result = get_reassoc_pow_ssa_name (target, type);
+ iter_result = make_temp_ssa_name (type, NULL, "reassocpow");
pow_stmt = gimple_build_call (powi_fndecl, 2, rf1->repr,
build_int_cst (integer_type_node,
power));
@@ -3334,7 +3314,7 @@ attempt_builtin_powi (gimple stmt, VEC(operand_entry_t, heap) **ops,
form the product of this one and those others. */
if (result)
{
- tree new_result = get_reassoc_pow_ssa_name (target, type);
+ tree new_result = make_temp_ssa_name (type, NULL, "reassocpow");
mul_stmt = gimple_build_assign_with_ops (MULT_EXPR, new_result,
result, iter_result);
gimple_set_location (mul_stmt, gimple_location (stmt));
@@ -3447,7 +3427,6 @@ reassociate_bb (basic_block bb)
{
gimple_stmt_iterator gsi;
basic_block son;
- tree target = NULL_TREE;
for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi))
{
@@ -3533,7 +3512,7 @@ reassociate_bb (basic_block bb)
if (first_pass_instance
&& rhs_code == MULT_EXPR
&& flag_unsafe_math_optimizations)
- powi_result = attempt_builtin_powi (stmt, &ops, &target);
+ powi_result = attempt_builtin_powi (stmt, &ops);
/* If the operand vector is now empty, all operands were
consumed by the __builtin_powi optimization. */
@@ -3572,8 +3551,8 @@ reassociate_bb (basic_block bb)
{
gimple mul_stmt;
tree type = TREE_TYPE (gimple_get_lhs (stmt));
- tree target_ssa = get_reassoc_pow_ssa_name (&target,
- type);
+ tree target_ssa = make_temp_ssa_name (type, NULL,
+ "reassocpow");
gimple_set_lhs (stmt, target_ssa);
update_stmt (stmt);
mul_stmt = gimple_build_assign_with_ops (MULT_EXPR, lhs,
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index e19ad5a0abd..3a60a0a1ba0 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -393,7 +393,7 @@ get_string_length (strinfo si)
if (si->stmt)
{
gimple stmt = si->stmt, lenstmt;
- tree callee, lhs, lhs_var, fn, tem;
+ tree callee, lhs, fn, tem;
location_t loc;
gimple_stmt_iterator gsi;
@@ -415,15 +415,12 @@ get_string_length (strinfo si)
gsi = gsi_for_stmt (stmt);
fn = builtin_decl_implicit (BUILT_IN_STRLEN);
gcc_assert (lhs == NULL_TREE);
- lhs_var = create_tmp_var (TREE_TYPE (TREE_TYPE (fn)), NULL);
tem = unshare_expr (gimple_call_arg (stmt, 0));
lenstmt = gimple_build_call (fn, 1, tem);
- lhs = make_ssa_name (lhs_var, lenstmt);
+ lhs = make_ssa_name (TREE_TYPE (TREE_TYPE (fn)), lenstmt);
gimple_call_set_lhs (lenstmt, lhs);
gimple_set_vuse (lenstmt, gimple_vuse (stmt));
gsi_insert_before (&gsi, lenstmt, GSI_SAME_STMT);
- lhs_var = create_tmp_var (TREE_TYPE (gimple_call_arg (stmt, 0)),
- NULL);
tem = gimple_call_arg (stmt, 0);
if (!ptrofftype_p (TREE_TYPE (lhs)))
{
@@ -432,9 +429,10 @@ get_string_length (strinfo si)
true, GSI_SAME_STMT);
}
lenstmt
- = gimple_build_assign_with_ops (POINTER_PLUS_EXPR,
- make_ssa_name (lhs_var, NULL),
- tem, lhs);
+ = gimple_build_assign_with_ops
+ (POINTER_PLUS_EXPR,
+ make_ssa_name (TREE_TYPE (gimple_call_arg (stmt, 0)), NULL),
+ tem, lhs);
gsi_insert_before (&gsi, lenstmt, GSI_SAME_STMT);
gimple_call_set_arg (stmt, 0, gimple_assign_lhs (lenstmt));
lhs = NULL_TREE;
@@ -452,8 +450,7 @@ get_string_length (strinfo si)
print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
}
gimple_call_set_fndecl (stmt, fn);
- lhs_var = create_tmp_var (TREE_TYPE (TREE_TYPE (fn)), NULL);
- lhs = make_ssa_name (lhs_var, stmt);
+ lhs = make_ssa_name (TREE_TYPE (TREE_TYPE (fn)), stmt);
gimple_call_set_lhs (stmt, lhs);
update_stmt (stmt);
if (dump_file && (dump_flags & TDF_DETAILS) != 0)
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 4336e5cc592..df88ddf77e8 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -424,15 +424,13 @@ emit_case_bit_tests (gimple swtch, tree index_expr,
}
/* csui = (1 << (word_mode) idx) */
- tmp = create_tmp_var (word_type_node, "csui");
- csui = make_ssa_name (tmp, NULL);
+ csui = make_ssa_name (word_type_node, NULL);
tmp = fold_build2 (LSHIFT_EXPR, word_type_node, word_mode_one,
fold_convert (word_type_node, idx));
tmp = force_gimple_operand_gsi (&gsi, tmp,
/*simple=*/false, NULL_TREE,
/*before=*/true, GSI_SAME_STMT);
shift_stmt = gimple_build_assign (csui, tmp);
- SSA_NAME_DEF_STMT (csui) = shift_stmt;
gsi_insert_before (&gsi, shift_stmt, GSI_SAME_STMT);
update_stmt (shift_stmt);
@@ -1090,7 +1088,7 @@ static void
build_arrays (gimple swtch, struct switch_conv_info *info)
{
tree arr_index_type;
- tree tidx, sub, tmp, utype;
+ tree tidx, sub, utype;
gimple stmt;
gimple_stmt_iterator gsi;
int i;
@@ -1106,15 +1104,13 @@ build_arrays (gimple swtch, struct switch_conv_info *info)
utype = lang_hooks.types.type_for_mode (TYPE_MODE (utype), 1);
arr_index_type = build_index_type (info->range_size);
- tmp = create_tmp_var (utype, "csui");
- tidx = make_ssa_name (tmp, NULL);
+ tidx = make_ssa_name (utype, NULL);
sub = fold_build2_loc (loc, MINUS_EXPR, utype,
fold_convert_loc (loc, utype, info->index_expr),
fold_convert_loc (loc, utype, info->range_min));
sub = force_gimple_operand_gsi (&gsi, sub,
false, NULL, true, GSI_SAME_STMT);
stmt = gimple_build_assign (tidx, sub);
- SSA_NAME_DEF_STMT (tidx) = stmt;
gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
update_stmt (stmt);
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index 594617a67fe..7ee00a2a319 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -609,12 +609,11 @@ adjust_return_value_with_ops (enum tree_code code, const char *label,
{
tree ret_type = TREE_TYPE (DECL_RESULT (current_function_decl));
- tree tmp = create_tmp_reg (ret_type, label);
+ tree result = make_temp_ssa_name (ret_type, NULL, label);
gimple stmt;
- tree result;
if (types_compatible_p (TREE_TYPE (acc), TREE_TYPE (op1)))
- stmt = gimple_build_assign_with_ops (code, tmp, acc, op1);
+ stmt = gimple_build_assign_with_ops (code, result, acc, op1);
else
{
tree rhs = fold_convert (TREE_TYPE (acc),
@@ -624,12 +623,9 @@ adjust_return_value_with_ops (enum tree_code code, const char *label,
op1));
rhs = force_gimple_operand_gsi (&gsi, rhs,
false, NULL, true, GSI_CONTINUE_LINKING);
- stmt = gimple_build_assign (NULL_TREE, rhs);
+ stmt = gimple_build_assign (result, rhs);
}
- result = make_ssa_name (tmp, stmt);
- gimple_assign_set_lhs (stmt, result);
- update_stmt (stmt);
gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);
return result;
}
@@ -904,7 +900,7 @@ static tree
create_tailcall_accumulator (const char *label, basic_block bb, tree init)
{
tree ret_type = TREE_TYPE (DECL_RESULT (current_function_decl));
- tree tmp = create_tmp_reg (ret_type, label);
+ tree tmp = make_temp_ssa_name (ret_type, NULL, label);
gimple phi;
phi = create_phi_node (tmp, bb);
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index ad59bf37d8c..6a02986cc80 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -4129,7 +4129,7 @@ vect_permute_store_chain (VEC(tree,heap) *dr_chain,
gimple_stmt_iterator *gsi,
VEC(tree,heap) **result_chain)
{
- tree perm_dest, vect1, vect2, high, low;
+ tree vect1, vect2, high, low;
gimple perm_stmt;
tree vectype = STMT_VINFO_VECTYPE (vinfo_for_stmt (stmt));
tree perm_mask_low, perm_mask_high;
@@ -4161,8 +4161,7 @@ vect_permute_store_chain (VEC(tree,heap) *dr_chain,
/* Create interleaving stmt:
high = VEC_PERM_EXPR <vect1, vect2, {0, nelt, 1, nelt+1, ...}> */
- perm_dest = create_tmp_reg (vectype, "vect_inter_high");
- high = make_ssa_name (perm_dest, NULL);
+ high = make_temp_ssa_name (vectype, NULL, "vect_inter_high");
perm_stmt
= gimple_build_assign_with_ops3 (VEC_PERM_EXPR, high,
vect1, vect2, perm_mask_high);
@@ -4172,8 +4171,7 @@ vect_permute_store_chain (VEC(tree,heap) *dr_chain,
/* Create interleaving stmt:
low = VEC_PERM_EXPR <vect1, vect2, {nelt/2, nelt*3/2, nelt/2+1,
nelt*3/2+1, ...}> */
- perm_dest = create_tmp_reg (vectype, "vect_inter_low");
- low = make_ssa_name (perm_dest, NULL);
+ low = make_temp_ssa_name (vectype, NULL, "vect_inter_low");
perm_stmt
= gimple_build_assign_with_ops3 (VEC_PERM_EXPR, low,
vect1, vect2, perm_mask_low);
@@ -4584,7 +4582,7 @@ vect_permute_load_chain (VEC(tree,heap) *dr_chain,
gimple_stmt_iterator *gsi,
VEC(tree,heap) **result_chain)
{
- tree perm_dest, data_ref, first_vect, second_vect;
+ tree data_ref, first_vect, second_vect;
tree perm_mask_even, perm_mask_odd;
gimple perm_stmt;
tree vectype = STMT_VINFO_VECTYPE (vinfo_for_stmt (stmt));
@@ -4612,29 +4610,19 @@ vect_permute_load_chain (VEC(tree,heap) *dr_chain,
second_vect = VEC_index (tree, dr_chain, j+1);
/* data_ref = permute_even (first_data_ref, second_data_ref); */
- perm_dest = create_tmp_reg (vectype, "vect_perm_even");
-
- perm_stmt = gimple_build_assign_with_ops3 (VEC_PERM_EXPR, perm_dest,
+ data_ref = make_temp_ssa_name (vectype, NULL, "vect_perm_even");
+ perm_stmt = gimple_build_assign_with_ops3 (VEC_PERM_EXPR, data_ref,
first_vect, second_vect,
perm_mask_even);
-
- data_ref = make_ssa_name (perm_dest, perm_stmt);
- gimple_assign_set_lhs (perm_stmt, data_ref);
vect_finish_stmt_generation (stmt, perm_stmt, gsi);
-
VEC_replace (tree, *result_chain, j/2, data_ref);
/* data_ref = permute_odd (first_data_ref, second_data_ref); */
- perm_dest = create_tmp_reg (vectype, "vect_perm_odd");
-
- perm_stmt = gimple_build_assign_with_ops3 (VEC_PERM_EXPR, perm_dest,
+ data_ref = make_temp_ssa_name (vectype, NULL, "vect_perm_odd");
+ perm_stmt = gimple_build_assign_with_ops3 (VEC_PERM_EXPR, data_ref,
first_vect, second_vect,
perm_mask_odd);
-
- data_ref = make_ssa_name (perm_dest, perm_stmt);
- gimple_assign_set_lhs (perm_stmt, data_ref);
vect_finish_stmt_generation (stmt, perm_stmt, gsi);
-
VEC_replace (tree, *result_chain, j/2+length/2, data_ref);
}
dr_chain = VEC_copy (tree, heap, *result_chain);
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index 4b34c214d86..5b583124cab 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -667,8 +667,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
((unsigned HOST_WIDE_INT) 1
<< shifts[i]) - 1);
cst = build_vector (type, vec);
- addend = create_tmp_reg (type, NULL);
- addend = make_ssa_name (addend, NULL);
+ addend = make_ssa_name (type, NULL);
stmt = gimple_build_assign_with_ops3 (VEC_COND_EXPR, addend,
cond, cst, zero);
gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 5eda1f2ee10..e0b68c71cfa 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -2207,7 +2207,7 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo,
tree int_ptrsize_type;
char tmp_name[20];
tree or_tmp_name = NULL_TREE;
- tree and_tmp, and_tmp_name;
+ tree and_tmp_name;
gimple and_stmt;
tree ptrsize_zero;
tree part_cond_expr;
@@ -2225,8 +2225,8 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo,
{
gimple_seq new_stmt_list = NULL;
tree addr_base;
- tree addr_tmp, addr_tmp_name;
- tree or_tmp, new_or_tmp_name;
+ tree addr_tmp_name;
+ tree new_or_tmp_name;
gimple addr_stmt, or_stmt;
stmt_vec_info stmt_vinfo = vinfo_for_stmt (ref_stmt);
tree vectype = STMT_VINFO_VECTYPE (stmt_vinfo);
@@ -2242,12 +2242,10 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo,
if (new_stmt_list != NULL)
gimple_seq_add_seq (cond_expr_stmt_list, new_stmt_list);
- sprintf (tmp_name, "%s%d", "addr2int", i);
- addr_tmp = create_tmp_reg (int_ptrsize_type, tmp_name);
- addr_tmp_name = make_ssa_name (addr_tmp, NULL);
+ sprintf (tmp_name, "addr2int%d", i);
+ addr_tmp_name = make_temp_ssa_name (int_ptrsize_type, NULL, tmp_name);
addr_stmt = gimple_build_assign_with_ops (NOP_EXPR, addr_tmp_name,
addr_base, NULL_TREE);
- SSA_NAME_DEF_STMT (addr_tmp_name) = addr_stmt;
gimple_seq_add_stmt (cond_expr_stmt_list, addr_stmt);
/* The addresses are OR together. */
@@ -2255,13 +2253,11 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo,
if (or_tmp_name != NULL_TREE)
{
/* create: or_tmp = or_tmp | addr_tmp */
- sprintf (tmp_name, "%s%d", "orptrs", i);
- or_tmp = create_tmp_reg (int_ptrsize_type, tmp_name);
- new_or_tmp_name = make_ssa_name (or_tmp, NULL);
+ sprintf (tmp_name, "orptrs%d", i);
+ new_or_tmp_name = make_temp_ssa_name (int_ptrsize_type, NULL, tmp_name);
or_stmt = gimple_build_assign_with_ops (BIT_IOR_EXPR,
new_or_tmp_name,
or_tmp_name, addr_tmp_name);
- SSA_NAME_DEF_STMT (new_or_tmp_name) = or_stmt;
gimple_seq_add_stmt (cond_expr_stmt_list, or_stmt);
or_tmp_name = new_or_tmp_name;
}
@@ -2273,12 +2269,10 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo,
mask_cst = build_int_cst (int_ptrsize_type, mask);
/* create: and_tmp = or_tmp & mask */
- and_tmp = create_tmp_reg (int_ptrsize_type, "andmask" );
- and_tmp_name = make_ssa_name (and_tmp, NULL);
+ and_tmp_name = make_temp_ssa_name (int_ptrsize_type, NULL, "andmask");
and_stmt = gimple_build_assign_with_ops (BIT_AND_EXPR, and_tmp_name,
or_tmp_name, mask_cst);
- SSA_NAME_DEF_STMT (and_tmp_name) = and_stmt;
gimple_seq_add_stmt (cond_expr_stmt_list, and_stmt);
/* Make and_tmp the left operand of the conditional test against zero.
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index fabd65e2070..1b78a54c42e 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -206,9 +206,7 @@ type_conversion_p (tree name, gimple use_stmt, bool check_sign,
static tree
vect_recog_temp_ssa_var (tree type, gimple stmt)
{
- tree var = create_tmp_reg (type, "patt");
- var = make_ssa_name (var, stmt);
- return var;
+ return make_temp_ssa_name (type, stmt, "patt");
}
/* Function vect_recog_dot_prod_pattern
@@ -450,7 +448,7 @@ vect_handle_widen_op_by_const (gimple stmt, enum tree_code code,
VEC (gimple, heap) **stmts, tree type,
tree *half_type, gimple def_stmt)
{
- tree new_type, new_oprnd, tmp;
+ tree new_type, new_oprnd;
gimple new_stmt;
if (code != MULT_EXPR && code != LSHIFT_EXPR)
@@ -499,8 +497,7 @@ vect_handle_widen_op_by_const (gimple stmt, enum tree_code code,
{
/* Create a_T = (NEW_TYPE) a_t; */
*oprnd = gimple_assign_rhs1 (def_stmt);
- tmp = create_tmp_reg (new_type, NULL);
- new_oprnd = make_ssa_name (tmp, NULL);
+ new_oprnd = make_ssa_name (new_type, NULL);
new_stmt = gimple_build_assign_with_ops (NOP_EXPR, new_oprnd, *oprnd,
NULL_TREE);
STMT_VINFO_RELATED_STMT (vinfo_for_stmt (def_stmt)) = new_stmt;
@@ -962,7 +959,7 @@ vect_operation_fits_smaller_type (gimple stmt, tree def, tree *new_type,
{
enum tree_code code;
tree const_oprnd, oprnd;
- tree interm_type = NULL_TREE, half_type, tmp, new_oprnd, type;
+ tree interm_type = NULL_TREE, half_type, new_oprnd, type;
gimple def_stmt, new_stmt;
bool first = false;
bool promotion;
@@ -1103,8 +1100,7 @@ vect_operation_fits_smaller_type (gimple stmt, tree def, tree *new_type,
{
/* Create NEW_OPRND = (INTERM_TYPE) OPRND. */
oprnd = gimple_assign_rhs1 (def_stmt);
- tmp = create_tmp_reg (interm_type, NULL);
- new_oprnd = make_ssa_name (tmp, NULL);
+ new_oprnd = make_ssa_name (interm_type, NULL);
new_stmt = gimple_build_assign_with_ops (NOP_EXPR, new_oprnd,
oprnd, NULL_TREE);
STMT_VINFO_RELATED_STMT (vinfo_for_stmt (def_stmt)) = new_stmt;
@@ -1123,8 +1119,7 @@ vect_operation_fits_smaller_type (gimple stmt, tree def, tree *new_type,
if (interm_type)
{
/* Create a type conversion HALF_TYPE->INTERM_TYPE. */
- tmp = create_tmp_reg (interm_type, NULL);
- new_oprnd = make_ssa_name (tmp, NULL);
+ new_oprnd = make_ssa_name (interm_type, NULL);
new_stmt = gimple_build_assign_with_ops (NOP_EXPR, new_oprnd,
oprnd, NULL_TREE);
oprnd = new_oprnd;
@@ -1171,7 +1166,7 @@ vect_recog_over_widening_pattern (VEC (gimple, heap) **stmts,
gimple stmt = VEC_pop (gimple, *stmts);
gimple pattern_stmt = NULL, new_def_stmt, prev_stmt = NULL, use_stmt = NULL;
tree op0, op1, vectype = NULL_TREE, use_lhs, use_type;
- tree var = NULL_TREE, new_type = NULL_TREE, tmp, new_oprnd;
+ tree var = NULL_TREE, new_type = NULL_TREE, new_oprnd;
bool first;
tree type = NULL;
@@ -1254,8 +1249,7 @@ vect_recog_over_widening_pattern (VEC (gimple, heap) **stmts,
|| TYPE_PRECISION (new_type) != TYPE_PRECISION (use_type))
{
/* Create NEW_TYPE->USE_TYPE conversion. */
- tmp = create_tmp_reg (use_type, NULL);
- new_oprnd = make_ssa_name (tmp, NULL);
+ new_oprnd = make_ssa_name (use_type, NULL);
pattern_stmt = gimple_build_assign_with_ops (NOP_EXPR, new_oprnd,
var, NULL_TREE);
STMT_VINFO_RELATED_STMT (vinfo_for_stmt (use_stmt)) = pattern_stmt;
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 4769e6269ee..491b2391f88 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -1270,12 +1270,10 @@ vect_init_vector (gimple stmt, tree val, tree type, gimple_stmt_iterator *gsi)
val = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (type), val);
else
{
- new_var = create_tmp_reg (TREE_TYPE (type), NULL);
+ new_temp = make_ssa_name (TREE_TYPE (type), NULL);
init_stmt = gimple_build_assign_with_ops (NOP_EXPR,
- new_var, val,
+ new_temp, val,
NULL_TREE);
- new_temp = make_ssa_name (new_var, init_stmt);
- gimple_assign_set_lhs (init_stmt, new_temp);
vect_init_vector_1 (stmt, init_stmt, gsi);
val = new_temp;
}
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index a5b583b66d5..eb6402bd281 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -8042,13 +8042,9 @@ simplify_truth_ops_using_ranges (gimple_stmt_iterator *gsi, gimple stmt)
/* For A != B we substitute A ^ B. Either with conversion. */
else if (need_conversion)
{
- gimple newop;
- tree tem = create_tmp_reg (TREE_TYPE (op0), NULL);
- newop = gimple_build_assign_with_ops (BIT_XOR_EXPR, tem, op0, op1);
- tem = make_ssa_name (tem, newop);
- gimple_assign_set_lhs (newop, tem);
+ tree tem = make_ssa_name (TREE_TYPE (op0), NULL);
+ gimple newop = gimple_build_assign_with_ops (BIT_XOR_EXPR, tem, op0, op1);
gsi_insert_before (gsi, newop, GSI_SAME_STMT);
- update_stmt (newop);
gimple_assign_set_rhs_with_ops (gsi, NOP_EXPR, tem, NULL_TREE);
}
/* Or without. */
@@ -8707,11 +8703,9 @@ simplify_float_conversion_using_ranges (gimple_stmt_iterator *gsi, gimple stmt)
/* It works, insert a truncation or sign-change before the
float conversion. */
- tem = create_tmp_var (build_nonstandard_integer_type
+ tem = make_ssa_name (build_nonstandard_integer_type
(GET_MODE_PRECISION (mode), 0), NULL);
conv = gimple_build_assign_with_ops (NOP_EXPR, tem, rhs1, NULL_TREE);
- tem = make_ssa_name (tem, conv);
- gimple_assign_set_lhs (conv, tem);
gsi_insert_before (gsi, conv, GSI_SAME_STMT);
gimple_assign_set_rhs1 (stmt, tem);
update_stmt (stmt);
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 702871ebc4d..e210881289e 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -592,7 +592,7 @@ gimple_divmod_fixed_value (gimple stmt, tree value, int prob, gcov_type count,
gcov_type all)
{
gimple stmt1, stmt2, stmt3;
- tree tmp0, tmp1, tmp2, tmpv;
+ tree tmp0, tmp1, tmp2;
gimple bb1end, bb2end, bb3end;
basic_block bb, bb2, bb3, bb4;
tree optype, op1, op2;
@@ -610,13 +610,10 @@ gimple_divmod_fixed_value (gimple stmt, tree value, int prob, gcov_type count,
bb = gimple_bb (stmt);
gsi = gsi_for_stmt (stmt);
- tmpv = create_tmp_reg (optype, "PROF");
- tmp0 = make_ssa_name (tmpv, NULL);
- tmp1 = make_ssa_name (tmpv, NULL);
+ tmp0 = make_temp_ssa_name (optype, NULL, "PROF");
+ tmp1 = make_temp_ssa_name (optype, NULL, "PROF");
stmt1 = gimple_build_assign (tmp0, fold_convert (optype, value));
- SSA_NAME_DEF_STMT (tmp0) = stmt1;
stmt2 = gimple_build_assign (tmp1, op2);
- SSA_NAME_DEF_STMT (tmp1) = stmt2;
stmt3 = gimple_build_cond (NE_EXPR, tmp1, tmp0, NULL_TREE, NULL_TREE);
gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
gsi_insert_before (&gsi, stmt2, GSI_SAME_STMT);
@@ -749,7 +746,7 @@ static tree
gimple_mod_pow2 (gimple stmt, int prob, gcov_type count, gcov_type all)
{
gimple stmt1, stmt2, stmt3, stmt4;
- tree tmp2, tmp3, tmpv;
+ tree tmp2, tmp3;
gimple bb1end, bb2end, bb3end;
basic_block bb, bb2, bb3, bb4;
tree optype, op1, op2;
@@ -768,14 +765,11 @@ gimple_mod_pow2 (gimple stmt, int prob, gcov_type count, gcov_type all)
gsi = gsi_for_stmt (stmt);
result = create_tmp_reg (optype, "PROF");
- tmpv = create_tmp_var (optype, "PROF");
- tmp2 = make_ssa_name (tmpv, NULL);
- tmp3 = make_ssa_name (tmpv, NULL);
+ tmp2 = make_temp_ssa_name (optype, NULL, "PROF");
+ tmp3 = make_temp_ssa_name (optype, NULL, "PROF");
stmt2 = gimple_build_assign_with_ops (PLUS_EXPR, tmp2, op2,
build_int_cst (optype, -1));
- SSA_NAME_DEF_STMT (tmp2) = stmt2;
stmt3 = gimple_build_assign_with_ops (BIT_AND_EXPR, tmp3, tmp2, op2);
- SSA_NAME_DEF_STMT (tmp3) = stmt3;
stmt4 = gimple_build_cond (NE_EXPR, tmp3, build_int_cst (optype, 0),
NULL_TREE, NULL_TREE);
gsi_insert_before (&gsi, stmt2, GSI_SAME_STMT);
@@ -924,10 +918,9 @@ gimple_mod_subtract (gimple stmt, int prob1, int prob2, int ncounts,
gsi = gsi_for_stmt (stmt);
result = create_tmp_reg (optype, "PROF");
- tmp1 = make_ssa_name (create_tmp_var (optype, "PROF"), NULL);
+ tmp1 = make_temp_ssa_name (optype, NULL, "PROF");
stmt1 = gimple_build_assign (result, op1);
stmt2 = gimple_build_assign (tmp1, op2);
- SSA_NAME_DEF_STMT (tmp1) = stmt2;
stmt3 = gimple_build_cond (LT_EXPR, result, tmp1, NULL_TREE, NULL_TREE);
gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
gsi_insert_before (&gsi, stmt2, GSI_SAME_STMT);
@@ -1176,7 +1169,7 @@ gimple_ic (gimple icall_stmt, struct cgraph_node *direct_call,
int prob, gcov_type count, gcov_type all)
{
gimple dcall_stmt, load_stmt, cond_stmt;
- tree tmp0, tmp1, tmpv, tmp;
+ tree tmp0, tmp1, tmp;
basic_block cond_bb, dcall_bb, icall_bb, join_bb = NULL;
tree optype = build_pointer_type (void_type_node);
edge e_cd, e_ci, e_di, e_dj = NULL, e_ij;
@@ -1186,18 +1179,15 @@ gimple_ic (gimple icall_stmt, struct cgraph_node *direct_call,
cond_bb = gimple_bb (icall_stmt);
gsi = gsi_for_stmt (icall_stmt);
- tmpv = create_tmp_reg (optype, "PROF");
- tmp0 = make_ssa_name (tmpv, NULL);
- tmp1 = make_ssa_name (tmpv, NULL);
+ tmp0 = make_temp_ssa_name (optype, NULL, "PROF");
+ tmp1 = make_temp_ssa_name (optype, NULL, "PROF");
tmp = unshare_expr (gimple_call_fn (icall_stmt));
load_stmt = gimple_build_assign (tmp0, tmp);
- SSA_NAME_DEF_STMT (tmp0) = load_stmt;
gsi_insert_before (&gsi, load_stmt, GSI_SAME_STMT);
tmp = fold_convert (optype, build_addr (direct_call->symbol.decl,
current_function_decl));
load_stmt = gimple_build_assign (tmp1, tmp);
- SSA_NAME_DEF_STMT (tmp1) = load_stmt;
gsi_insert_before (&gsi, load_stmt, GSI_SAME_STMT);
cond_stmt = gimple_build_cond (EQ_EXPR, tmp1, tmp0, NULL_TREE, NULL_TREE);
@@ -1431,7 +1421,7 @@ gimple_stringop_fixed_value (gimple vcall_stmt, tree icall_size, int prob,
gcov_type count, gcov_type all)
{
gimple tmp_stmt, cond_stmt, icall_stmt;
- tree tmp0, tmp1, tmpv, vcall_size, optype;
+ tree tmp0, tmp1, vcall_size, optype;
basic_block cond_bb, icall_bb, vcall_bb, join_bb;
edge e_ci, e_cv, e_iv, e_ij, e_vj;
gimple_stmt_iterator gsi;
@@ -1448,15 +1438,12 @@ gimple_stringop_fixed_value (gimple vcall_stmt, tree icall_size, int prob,
vcall_size = gimple_call_arg (vcall_stmt, size_arg);
optype = TREE_TYPE (vcall_size);
- tmpv = create_tmp_var (optype, "PROF");
- tmp0 = make_ssa_name (tmpv, NULL);
- tmp1 = make_ssa_name (tmpv, NULL);
+ tmp0 = make_temp_ssa_name (optype, NULL, "PROF");
+ tmp1 = make_temp_ssa_name (optype, NULL, "PROF");
tmp_stmt = gimple_build_assign (tmp0, fold_convert (optype, icall_size));
- SSA_NAME_DEF_STMT (tmp0) = tmp_stmt;
gsi_insert_before (&gsi, tmp_stmt, GSI_SAME_STMT);
tmp_stmt = gimple_build_assign (tmp1, vcall_size);
- SSA_NAME_DEF_STMT (tmp1) = tmp_stmt;
gsi_insert_before (&gsi, tmp_stmt, GSI_SAME_STMT);
cond_stmt = gimple_build_cond (EQ_EXPR, tmp1, tmp0, NULL_TREE, NULL_TREE);