This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][0/n] Allow anonymous SSA names
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 3 Aug 2012 12:09:08 +0200 (CEST)
- Subject: [PATCH][0/n] Allow anonymous SSA names
This patch series will allow gimple SSA passes to create new temporary
SSA names without creating a new decl. That means that SSA_NAME_VAR
for such SSA names can be NULL_TREE (so we have to deal with the fallout).
To make debugging dumps still readable we can put an INDENTIFIER_NODE
in the place of the decl to get fancy dumping.
Let examples speak for themselves. From tree-ssa-forwprop.c:
@@ -2051,11 +2035,9 @@ simplify_bitwise_binary (gimple_stmt_ite
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);
which saves you writing three lines (and saves us one VAR_DECL node
which isn't cheap).
>From tree-ssa-pre.c:
@@ -3101,16 +3095,8 @@ create_expression_by_pieces (basic_block
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);
this uses a "named" SSA name. Same savings apply but PRE does try
to do some fancy variable decl sharing which is no longer necessary.
The following is a work-in-progress patch, ChangeLog is only for
the interesting parts. The patch does not bootstrap or regtest
(it passes the tree-ssa.exp and most of the execute testsuite).
I'm posting this to get some comments (and bikeshedding about
overloading make_ssa_name and make_temp_ssa_names name).
Thus, comments?
I will probably split out parts of the patch and introduce some
SSA name predicates that hide the SSA_NAME_VAR change
(namely SSA_NAME_FOR_RESULT_DECL_P, SSA_NAME_FOR_PARM_DECL_P,
SSA_NAME_ARTIFICIAL_P).
The idea of this patch is twofold - first simplify writing passes
(make it easier for new devs, etc. ...), second save memory and
compile-time. For the latter I plan to count created decls
during bootstrap from before and after the patch (well, once that
bootstraps ;)).
Thanks,
Richard.
TODO:
* Add SSA_NAME_FOR_RESULT_DECL (), SSA_NAME_FOR_PARM_DECL () macros,
hiding the fact that SSA_NAME_VAR may be NULL.
* Likewise add a SSA_NAME_ARTIFICIAL () macro
2012-08-03 Richard Guenther <rguenther@suse.de>
* tree.h (SSA_NAME_VAR): Return NULL_TREE if an IDENTIFIER_NODE
is recorded as var.
(SET_SSA_NAME_VAR): New setter.
(SSA_NAME_IDENTIFIER): New raw accessor for var.
(VAR_PARM_OR_RESULT_DECL_P): New predicate.
(SSA_VAR_P): Simplify.
* tree-ssanames.c (make_ssa_name_fn): Handle creating anonymous
SSA names by passing a type instead of a variable decl.
(release_ssa_name): Use SET_SSA_NAME_VAR.
(duplicate_ssa_name): Handle anonymous SSA names.
(replace_ssa_name_symbol): Use SET_SSA_NAME_VAR.
* tree-flow-inline.h (make_temp_ssa_name): New inline function.
* tree-pretty-print.c (dump_generic_node): Use SSA_NAME_IDENTIFIER,
dump SSA names without a name as <anon>.
* cfgexpand.c (expand_one_var): Assing anonymous SSA names we
are going to expand a decl.
(expand_used_vars): Handle anonymous SSA names.
(gimple_expand_cfg): Assign all SSA names of a partition the
decl we created for its leader.
* tree-ssa-forwprop.c (simplify_bitwise_binary): Use anonymous
SSA names.
* tree-ssa-pre.c (get_representative_for): Use anonymous named
SSA names.
(create_expression_by_pieces): Likewise.
(insert_into_preds_of_block): Likewise.
Index: gcc/tree-ssanames.c
===================================================================
*** gcc/tree-ssanames.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-ssanames.c 2012-08-03 11:28:49.643124340 +0200
*************** make_ssa_name_fn (struct function *fn, t
*** 118,124 ****
tree t;
use_operand_p imm;
! gcc_assert (DECL_P (var));
/* If our free list has an element, then use it. */
if (!VEC_empty (tree, FREE_SSANAMES (fn)))
--- 118,124 ----
tree t;
use_operand_p imm;
! gcc_assert (VAR_PARM_OR_RESULT_DECL_P (var) || TYPE_P (var));
/* If our free list has an element, then use it. */
if (!VEC_empty (tree, FREE_SSANAMES (fn)))
*************** make_ssa_name_fn (struct function *fn, t
*** 141,148 ****
ssa_name_nodes_created++;
}
! TREE_TYPE (t) = TREE_TYPE (var);
! SSA_NAME_VAR (t) = var;
SSA_NAME_DEF_STMT (t) = stmt;
SSA_NAME_PTR_INFO (t) = NULL;
SSA_NAME_IN_FREE_LIST (t) = 0;
--- 141,156 ----
ssa_name_nodes_created++;
}
! if (TYPE_P (var))
! {
! TREE_TYPE (t) = var;
! SET_SSA_NAME_VAR (t, NULL_TREE);
! }
! else
! {
! TREE_TYPE (t) = TREE_TYPE (var);
! SET_SSA_NAME_VAR (t, var);
! }
SSA_NAME_DEF_STMT (t) = stmt;
SSA_NAME_PTR_INFO (t) = NULL;
SSA_NAME_IN_FREE_LIST (t) = 0;
*************** release_ssa_name (tree var)
*** 223,229 ****
/* Hopefully this can go away once we have the new incremental
SSA updating code installed. */
! SSA_NAME_VAR (var) = saved_ssa_name_var;
/* Note this SSA_NAME is now in the first list. */
SSA_NAME_IN_FREE_LIST (var) = 1;
--- 231,237 ----
/* Hopefully this can go away once we have the new incremental
SSA updating code installed. */
! SET_SSA_NAME_VAR (var, saved_ssa_name_var);
/* Note this SSA_NAME is now in the first list. */
SSA_NAME_IN_FREE_LIST (var) = 1;
*************** duplicate_ssa_name_ptr_info (tree name,
*** 338,346 ****
tree
duplicate_ssa_name (tree name, gimple stmt)
{
! tree new_name = make_ssa_name (SSA_NAME_VAR (name), stmt);
! struct ptr_info_def *old_ptr_info = SSA_NAME_PTR_INFO (name);
if (old_ptr_info)
duplicate_ssa_name_ptr_info (new_name, old_ptr_info);
--- 346,363 ----
tree
duplicate_ssa_name (tree name, gimple stmt)
{
! struct ptr_info_def *old_ptr_info;
! tree new_name;
!
! if (SSA_NAME_VAR (name))
! new_name = make_ssa_name (SSA_NAME_VAR (name), stmt);
! else
! {
! new_name = make_ssa_name (TREE_TYPE (name), stmt);
! SET_SSA_NAME_VAR (new_name, SSA_NAME_IDENTIFIER (name));
! }
+ old_ptr_info = SSA_NAME_PTR_INFO (name);
if (old_ptr_info)
duplicate_ssa_name_ptr_info (new_name, old_ptr_info);
*************** release_defs (gimple stmt)
*** 371,377 ****
void
replace_ssa_name_symbol (tree ssa_name, tree sym)
{
! SSA_NAME_VAR (ssa_name) = sym;
TREE_TYPE (ssa_name) = TREE_TYPE (sym);
}
--- 388,394 ----
void
replace_ssa_name_symbol (tree ssa_name, tree sym)
{
! SET_SSA_NAME_VAR (ssa_name, sym);
TREE_TYPE (ssa_name) = TREE_TYPE (sym);
}
Index: gcc/tree-ssa-pre.c
===================================================================
*** gcc/tree-ssa-pre.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-ssa-pre.c 2012-08-03 10:54:15.680196147 +0200
*************** get_expr_type (const pre_expr e)
*** 1366,1372 ****
static tree
get_representative_for (const pre_expr e)
{
- tree exprtype;
tree name;
unsigned int value_id = get_expr_value_id (e);
--- 1366,1371 ----
*************** get_representative_for (const pre_expr e
*** 1406,1419 ****
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 ());
VN_INFO_GET (name)->value_id = value_id;
if (e->kind == CONSTANT)
VN_INFO (name)->valnum = PRE_EXPR_CONSTANT (e);
--- 1405,1413 ----
fprintf (dump_file, "\n");
}
/* Build and insert the assignment of the end result to the temporary
that we will return. */
! 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);
*************** static tree
*** 2983,2989 ****
create_expression_by_pieces (basic_block block, pre_expr expr,
gimple_seq *stmts, gimple domstmt, tree type)
{
! tree temp, name;
tree folded;
gimple_seq forced_stmts = NULL;
unsigned int value_id;
--- 2977,2983 ----
create_expression_by_pieces (basic_block block, pre_expr expr,
gimple_seq *stmts, gimple domstmt, tree type)
{
! tree name;
tree folded;
gimple_seq forced_stmts = NULL;
unsigned int value_id;
*************** create_expression_by_pieces (basic_block
*** 3101,3116 ****
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);
gimple_set_plf (newstmt, NECESSARY, false);
gimple_seq_add_stmt (stmts, newstmt);
--- 3095,3102 ----
gimple_seq_add_seq (stmts, forced_stmts);
}
! 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);
*************** insert_into_preds_of_block (basic_block
*** 3361,3375 ****
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;
phi = create_phi_node (temp, block);
gimple_set_plf (phi, NECESSARY, false);
VN_INFO_GET (gimple_phi_result (phi))->valnum = gimple_phi_result (phi);
--- 3347,3355 ----
return false;
/* Now build a phi for the new variable. */
! temp = make_temp_ssa_name (type, NULL, "prephitmp");
phi = create_phi_node (temp, block);
+ SSA_NAME_DEF_STMT (temp) = phi;
gimple_set_plf (phi, NECESSARY, false);
VN_INFO_GET (gimple_phi_result (phi))->valnum = gimple_phi_result (phi);
Index: gcc/gimple.c
===================================================================
*** gcc/gimple.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/gimple.c 2012-08-03 10:54:15.682196147 +0200
*************** is_gimple_reg (tree t)
*** 2785,2791 ****
if (TREE_CODE (t) == SSA_NAME)
{
t = SSA_NAME_VAR (t);
! if (TREE_CODE (t) == VAR_DECL
&& VAR_DECL_IS_VIRTUAL_OPERAND (t))
return false;
return true;
--- 2785,2791 ----
if (TREE_CODE (t) == SSA_NAME)
{
t = SSA_NAME_VAR (t);
! if (t && TREE_CODE (t) == VAR_DECL
&& VAR_DECL_IS_VIRTUAL_OPERAND (t))
return false;
return true;
Index: gcc/tree-ssa-operands.c
===================================================================
*** gcc/tree-ssa-operands.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-ssa-operands.c 2012-08-03 10:54:15.683196147 +0200
*************** add_virtual_operand (gimple stmt ATTRIBU
*** 626,644 ****
static void
add_stmt_operand (tree *var_p, gimple stmt, int flags)
{
! tree var, sym;
! gcc_assert (SSA_VAR_P (*var_p));
! var = *var_p;
! sym = (TREE_CODE (var) == SSA_NAME ? SSA_NAME_VAR (var) : var);
!
! /* Mark statements with volatile operands. */
! if (!(flags & opf_no_vops)
! && TREE_THIS_VOLATILE (sym))
! gimple_set_has_volatile_ops (stmt, true);
!
! if (is_gimple_reg (sym))
{
/* The variable is a GIMPLE register. Add it to real operands. */
if (flags & opf_def)
--- 626,639 ----
static void
add_stmt_operand (tree *var_p, gimple stmt, int flags)
{
! tree var = *var_p;
! gcc_assert (TREE_CODE (var) == SSA_NAME
! || TREE_CODE (var) == VAR_DECL
! || TREE_CODE (var) == PARM_DECL
! || TREE_CODE (var) == RESULT_DECL);
! if (is_gimple_reg (var))
{
/* The variable is a GIMPLE register. Add it to real operands. */
if (flags & opf_def)
*************** add_stmt_operand (tree *var_p, gimple st
*** 647,653 ****
append_use (var_p);
}
else
! add_virtual_operand (stmt, flags);
}
/* Mark the base address of REF as having its address taken.
--- 642,655 ----
append_use (var_p);
}
else
! {
! /* Mark statements with volatile operands. */
! if (!(flags & opf_no_vops)
! && TREE_THIS_VOLATILE (var))
! gimple_set_has_volatile_ops (stmt, true);
!
! add_virtual_operand (stmt, flags);
! }
}
/* Mark the base address of REF as having its address taken.
Index: gcc/tree-ssa.c
===================================================================
*** gcc/tree-ssa.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-ssa.c 2012-08-03 10:54:15.683196147 +0200
*************** verify_ssa_name (tree ssa_name, bool is_
*** 622,628 ****
return true;
}
! if (TREE_TYPE (ssa_name) != TREE_TYPE (SSA_NAME_VAR (ssa_name)))
{
error ("type mismatch between an SSA_NAME and its symbol");
return true;
--- 622,629 ----
return true;
}
! if (SSA_NAME_VAR (ssa_name) != NULL_TREE
! && TREE_TYPE (ssa_name) != TREE_TYPE (ssa_name))
{
error ("type mismatch between an SSA_NAME and its symbol");
return true;
*************** verify_def (basic_block bb, basic_block
*** 681,687 ****
if (verify_ssa_name (ssa_name, is_virtual))
goto err;
! if (TREE_CODE (SSA_NAME_VAR (ssa_name)) == RESULT_DECL
&& DECL_BY_REFERENCE (SSA_NAME_VAR (ssa_name)))
{
error ("RESULT_DECL should be read only when DECL_BY_REFERENCE is set");
--- 682,689 ----
if (verify_ssa_name (ssa_name, is_virtual))
goto err;
! if (SSA_NAME_VAR (ssa_name) != NULL_TREE
! && TREE_CODE (SSA_NAME_VAR (ssa_name)) == RESULT_DECL
&& DECL_BY_REFERENCE (SSA_NAME_VAR (ssa_name)))
{
error ("RESULT_DECL should be read only when DECL_BY_REFERENCE is set");
Index: gcc/tree.h
===================================================================
*** gcc/tree.h.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree.h 2012-08-03 10:54:15.684196147 +0200
*************** struct GTY(()) tree_exp {
*** 1980,1988 ****
/* SSA_NAME accessors. */
! /* Returns the variable being referenced. Once released, this is the
! only field that can be relied upon. */
! #define SSA_NAME_VAR(NODE) SSA_NAME_CHECK (NODE)->ssa_name.var
/* Returns the statement which defines this SSA name. */
#define SSA_NAME_DEF_STMT(NODE) SSA_NAME_CHECK (NODE)->ssa_name.def_stmt
--- 1980,2000 ----
/* SSA_NAME accessors. */
! /* Returns the raw SSA_NAME_VAR field which can be either the variable
! being referenced, an IDENTIFIER_NODE giving a temporary not associated
! with any variable a name or NULL_TREE. */
! #define SSA_NAME_IDENTIFIER(NODE) SSA_NAME_CHECK (NODE)->ssa_name.var
!
! /* Returns the variable being referenced. This can be NULL_TREE for
! temporaries not associated with any user variable.
! Once released, this is the only field that can be relied upon. */
! #define SSA_NAME_VAR(NODE) \
! (SSA_NAME_IDENTIFIER (NODE) == NULL_TREE \
! || TREE_CODE ((NODE)->ssa_name.var) == IDENTIFIER_NODE \
! ? NULL_TREE : (NODE)->ssa_name.var)
!
! #define SET_SSA_NAME_VAR(NODE,VAR) \
! do { SSA_NAME_CHECK (NODE)->ssa_name.var = (VAR); } while (0)
/* Returns the statement which defines this SSA name. */
#define SSA_NAME_DEF_STMT(NODE) SSA_NAME_CHECK (NODE)->ssa_name.def_stmt
*************** struct GTY (()) tree_binfo {
*** 2635,2650 ****
/* Define fields and accessors for nodes representing declared names. */
! /* Nonzero if DECL represents a variable for the SSA passes. */
#define SSA_VAR_P(DECL) \
(TREE_CODE (DECL) == VAR_DECL \
|| TREE_CODE (DECL) == PARM_DECL \
|| TREE_CODE (DECL) == RESULT_DECL \
! || (TREE_CODE (DECL) == SSA_NAME \
! && (TREE_CODE (SSA_NAME_VAR (DECL)) == VAR_DECL \
! || TREE_CODE (SSA_NAME_VAR (DECL)) == PARM_DECL \
! || TREE_CODE (SSA_NAME_VAR (DECL)) == RESULT_DECL)))
!
--- 2647,2665 ----
/* Define fields and accessors for nodes representing declared names. */
! /* Nonzero if DECL represents a VAR_DECL, PARM_DECL or RESULT_DECL. */
! #define VAR_PARM_OR_RESULT_DECL_P(DECL) \
! (TREE_CODE (DECL) == VAR_DECL \
! || TREE_CODE (DECL) == PARM_DECL \
! || TREE_CODE (DECL) == RESULT_DECL)
!
! /* Nonzero if DECL represents a variable for the SSA passes. All SSA
! names have underlying VAR_PARM_OR_RESULT_DECL_P. */
#define SSA_VAR_P(DECL) \
(TREE_CODE (DECL) == VAR_DECL \
|| TREE_CODE (DECL) == PARM_DECL \
|| TREE_CODE (DECL) == RESULT_DECL \
! || TREE_CODE (DECL) == SSA_NAME)
Index: gcc/tree-predcom.c
===================================================================
*** gcc/tree-predcom.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-predcom.c 2012-08-03 10:54:15.684196147 +0200
*************** eliminate_temp_copies (struct loop *loop
*** 1905,1911 ****
phi = gsi_stmt (psi);
name = PHI_RESULT (phi);
var = SSA_NAME_VAR (name);
! if (!bitmap_bit_p (tmp_vars, DECL_UID (var)))
continue;
use = PHI_ARG_DEF_FROM_EDGE (phi, e);
gcc_assert (TREE_CODE (use) == SSA_NAME);
--- 1905,1911 ----
phi = gsi_stmt (psi);
name = PHI_RESULT (phi);
var = SSA_NAME_VAR (name);
! if (!var || !bitmap_bit_p (tmp_vars, DECL_UID (var)))
continue;
use = PHI_ARG_DEF_FROM_EDGE (phi, e);
gcc_assert (TREE_CODE (use) == SSA_NAME);
Index: gcc/tree-ssa-copyrename.c
===================================================================
*** gcc/tree-ssa-copyrename.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-ssa-copyrename.c 2012-08-03 10:54:15.684196147 +0200
*************** copy_rename_partition_coalesce (var_map
*** 124,129 ****
--- 124,132 ----
gcc_assert (TREE_CODE (var1) == SSA_NAME);
gcc_assert (TREE_CODE (var2) == SSA_NAME);
+ if (!SSA_NAME_VAR (var1)
+ || !SSA_NAME_VAR (var2))
+ return false;
register_ssa_partition (map, var1);
register_ssa_partition (map, var2);
Index: gcc/tree-ssa-live.c
===================================================================
*** gcc/tree-ssa-live.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-ssa-live.c 2012-08-03 10:54:15.685196147 +0200
*************** var_map_base_init (var_map map)
*** 83,100 ****
unsigned baseindex;
var = partition_to_var (map, x);
var = SSA_NAME_VAR (var);
! /* If base variable hasn't been seen, set it up. */
! m->base.from = var;
! slot = (struct tree_int_map **) htab_find_slot (decl_to_index, m, INSERT);
! if (!*slot)
{
baseindex = m - mapstorage;
- m->to = baseindex;
- *slot = m;
m++;
}
else
! baseindex = (*slot)->to;
map->partition_to_base_index[x] = baseindex;
}
--- 83,109 ----
unsigned baseindex;
var = partition_to_var (map, x);
var = SSA_NAME_VAR (var);
! if (!var)
{
baseindex = m - mapstorage;
m++;
}
else
! {
! /* If base variable hasn't been seen, set it up. */
! m->base.from = var;
! slot = (struct tree_int_map **) htab_find_slot (decl_to_index,
! m, INSERT);
! if (!*slot)
! {
! baseindex = m - mapstorage;
! m->to = baseindex;
! *slot = m;
! m++;
! }
! else
! baseindex = (*slot)->to;
! }
map->partition_to_base_index[x] = baseindex;
}
*************** mark_all_vars_used_1 (tree *tp, int *wal
*** 360,366 ****
tree b;
if (TREE_CODE (t) == SSA_NAME)
! t = SSA_NAME_VAR (t);
if (IS_EXPR_CODE_CLASS (c)
&& (b = TREE_BLOCK (t)) != NULL)
--- 369,380 ----
tree b;
if (TREE_CODE (t) == SSA_NAME)
! {
! *walk_subtrees = 0;
! t = SSA_NAME_VAR (t);
! if (!t)
! return NULL;
! }
if (IS_EXPR_CODE_CLASS (c)
&& (b = TREE_BLOCK (t)) != NULL)
*************** verify_live_on_entry (tree_live_info_p l
*** 1236,1247 ****
for (i = 0; i < (unsigned)num_var_partitions (map); i++)
{
basic_block tmp;
! tree d;
bitmap loe;
var = partition_to_var (map, i);
stmt = SSA_NAME_DEF_STMT (var);
tmp = gimple_bb (stmt);
! d = ssa_default_def (cfun, SSA_NAME_VAR (var));
loe = live_on_entry (live, e->dest);
if (loe && bitmap_bit_p (loe, i))
--- 1250,1262 ----
for (i = 0; i < (unsigned)num_var_partitions (map); i++)
{
basic_block tmp;
! tree d = NULL_TREE;
bitmap loe;
var = partition_to_var (map, i);
stmt = SSA_NAME_DEF_STMT (var);
tmp = gimple_bb (stmt);
! if (SSA_NAME_VAR (var))
! d = ssa_default_def (cfun, SSA_NAME_VAR (var));
loe = live_on_entry (live, e->dest);
if (loe && bitmap_bit_p (loe, i))
Index: gcc/tree-ssa-coalesce.c
===================================================================
*** gcc/tree-ssa-coalesce.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-ssa-coalesce.c 2012-08-03 10:54:15.685196147 +0200
*************** create_outofssa_var_map (coalesce_list_p
*** 1130,1136 ****
if (var != NULL_TREE && is_gimple_reg (var))
{
/* Add coalesces between all the result decls. */
! if (TREE_CODE (SSA_NAME_VAR (var)) == RESULT_DECL)
{
if (first == NULL_TREE)
first = var;
--- 1130,1137 ----
if (var != NULL_TREE && is_gimple_reg (var))
{
/* Add coalesces between all the result decls. */
! if (SSA_NAME_VAR (var)
! && TREE_CODE (SSA_NAME_VAR (var)) == RESULT_DECL)
{
if (first == NULL_TREE)
first = var;
*************** attempt_coalesce (var_map map, ssa_confl
*** 1207,1215 ****
/* z is the new combined partition. Remove the other partition from
the list, and merge the conflicts. */
if (z == p1)
! ssa_conflicts_merge (graph, p1, p2);
else
! ssa_conflicts_merge (graph, p2, p1);
if (debug)
fprintf (debug, ": Success -> %d\n", z);
--- 1208,1226 ----
/* z is the new combined partition. Remove the other partition from
the list, and merge the conflicts. */
if (z == p1)
! {
! if (!SSA_NAME_VAR (var1)
! && SSA_NAME_VAR (var2))
! replace_ssa_name_symbol (var1, SSA_NAME_VAR (var2));
! ssa_conflicts_merge (graph, p1, p2);
! }
else
! {
! if (!SSA_NAME_VAR (var2)
! && SSA_NAME_VAR (var1))
! replace_ssa_name_symbol (var2, SSA_NAME_VAR (var1));
! ssa_conflicts_merge (graph, p2, p1);
! }
if (debug)
fprintf (debug, ": Success -> %d\n", z);
Index: gcc/cfgexpand.c
===================================================================
*** gcc/cfgexpand.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/cfgexpand.c 2012-08-03 10:54:15.685196147 +0200
*************** expand_one_var (tree var, bool toplevel,
*** 1086,1091 ****
--- 1086,1100 ----
unsigned int align = BITS_PER_UNIT;
tree origvar = var;
+ if (TREE_CODE (var) == SSA_NAME
+ && SSA_NAME_VAR (var) == NULL_TREE)
+ {
+ tree decl;
+ gcc_assert (really_expand);
+ decl = create_tmp_reg (TREE_TYPE (var), NULL);
+ replace_ssa_name_symbol (var, decl);
+ }
+
var = SSAVAR (var);
if (TREE_TYPE (var) != error_mark_node && TREE_CODE (var) == VAR_DECL)
*************** expand_used_vars (void)
*** 1460,1466 ****
tree var = partition_to_var (SA.map, i);
gcc_assert (is_gimple_reg (var));
! if (TREE_CODE (SSA_NAME_VAR (var)) == VAR_DECL)
expand_one_var (var, true, true);
else
{
--- 1469,1476 ----
tree var = partition_to_var (SA.map, i);
gcc_assert (is_gimple_reg (var));
! if (SSA_NAME_VAR (var) == NULL_TREE
! || TREE_CODE (SSA_NAME_VAR (var)) == VAR_DECL)
expand_one_var (var, true, true);
else
{
*************** gimple_expand_cfg (void)
*** 4440,4446 ****
rtx r;
if (!name
- || !POINTER_TYPE_P (TREE_TYPE (name))
/* We might have generated new SSA names in
update_alias_info_with_stack_vars. They will have a NULL
defining statements, and won't be part of the partitioning,
--- 4450,4455 ----
*************** gimple_expand_cfg (void)
*** 4450,4455 ****
--- 4459,4476 ----
part = var_to_partition (SA.map, name);
if (part == NO_PARTITION)
continue;
+
+ /* Adjust all partition members to get the underlying decl of
+ the representative which we might have created in expand_one_var. */
+ if (SSA_NAME_VAR (name) == NULL_TREE)
+ {
+ tree leader = partition_to_var (SA.map, part);
+ gcc_assert (SSA_NAME_VAR (leader) != NULL_TREE);
+ replace_ssa_name_symbol (name, SSA_NAME_VAR (leader));
+ }
+ if (!POINTER_TYPE_P (TREE_TYPE (name)))
+ continue;
+
r = SA.partition_to_pseudo[part];
if (REG_P (r))
mark_reg_pointer (r, get_pointer_alignment (name));
Index: gcc/tree-ssa-ter.c
===================================================================
*** gcc/tree-ssa-ter.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-ssa-ter.c 2012-08-03 10:54:15.686196147 +0200
*************** process_replaceable (temp_expr_table_p t
*** 498,507 ****
def = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF);
version = SSA_NAME_VERSION (def);
- basevar = SSA_NAME_VAR (def);
def_vars = BITMAP_ALLOC (NULL);
! bitmap_set_bit (def_vars, DECL_UID (basevar));
/* Add this expression to the dependency list for each use partition. */
FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_USE)
--- 498,509 ----
def = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF);
version = SSA_NAME_VERSION (def);
def_vars = BITMAP_ALLOC (NULL);
! /* ??? Can we really ignore this for anon SSA names? */
! basevar = SSA_NAME_VAR (def);
! if (basevar)
! bitmap_set_bit (def_vars, DECL_UID (basevar));
/* Add this expression to the dependency list for each use partition. */
FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_USE)
*************** process_replaceable (temp_expr_table_p t
*** 515,521 ****
bitmap_ior_into (def_vars, use_vars);
BITMAP_FREE (tab->expr_decl_uids[var_version]);
}
! else
bitmap_set_bit (def_vars, DECL_UID (SSA_NAME_VAR (var)));
}
tab->expr_decl_uids[version] = def_vars;
--- 517,524 ----
bitmap_ior_into (def_vars, use_vars);
BITMAP_FREE (tab->expr_decl_uids[var_version]);
}
! /* ??? Likewise. */
! else if (SSA_NAME_VAR (var))
bitmap_set_bit (def_vars, DECL_UID (SSA_NAME_VAR (var)));
}
tab->expr_decl_uids[version] = def_vars;
*************** find_replaceable_in_bb (temp_expr_table_
*** 626,632 ****
if (!bitmap_empty_p (vars))
FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter2, SSA_OP_DEF)
{
! if (bitmap_bit_p (vars, DECL_UID (SSA_NAME_VAR (def))))
{
same_root_var = true;
break;
--- 629,636 ----
if (!bitmap_empty_p (vars))
FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter2, SSA_OP_DEF)
{
! if (SSA_NAME_VAR (def)
! && bitmap_bit_p (vars, DECL_UID (SSA_NAME_VAR (def))))
{
same_root_var = true;
break;
Index: gcc/expr.c
===================================================================
*** gcc/expr.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/expr.c 2012-08-03 11:03:53.458176137 +0200
*************** expand_expr_real_1 (tree exp, rtx target
*** 9159,9166 ****
base variable. This unnecessarily allocates a pseudo, see how we can
reuse it, if partition base vars have it set already. */
if (!currently_expanding_to_rtl)
! return expand_expr_real_1 (SSA_NAME_VAR (exp), target, tmode, modifier,
! NULL);
g = get_gimple_for_ssa_name (exp);
/* For EXPAND_INITIALIZER try harder to get something simpler. */
--- 9159,9171 ----
base variable. This unnecessarily allocates a pseudo, see how we can
reuse it, if partition base vars have it set already. */
if (!currently_expanding_to_rtl)
! {
! tree var = SSA_NAME_VAR (exp);
! if (var && DECL_RTL_SET_P (var))
! return DECL_RTL (var);
! return gen_raw_REG (TYPE_MODE (TREE_TYPE (exp)),
! LAST_VIRTUAL_REGISTER + 1);
! }
g = get_gimple_for_ssa_name (exp);
/* For EXPAND_INITIALIZER try harder to get something simpler. */
Index: gcc/tree-cfg.c
===================================================================
*** gcc/tree-cfg.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-cfg.c 2012-08-03 11:29:12.464123542 +0200
*************** verify_gimple_return (gimple stmt)
*** 4176,4181 ****
--- 4176,4182 ----
if ((TREE_CODE (op) == RESULT_DECL
&& DECL_BY_REFERENCE (op))
|| (TREE_CODE (op) == SSA_NAME
+ && SSA_NAME_VAR (op)
&& TREE_CODE (SSA_NAME_VAR (op)) == RESULT_DECL
&& DECL_BY_REFERENCE (SSA_NAME_VAR (op))))
op = TREE_TYPE (op);
*************** gimple_make_forwarder_block (edge fallth
*** 5110,5116 ****
var = gimple_phi_result (phi);
new_phi = create_phi_node (var, bb);
SSA_NAME_DEF_STMT (var) = new_phi;
! gimple_phi_set_result (phi, make_ssa_name (SSA_NAME_VAR (var), phi));
add_phi_arg (new_phi, gimple_phi_result (phi), fallthru,
UNKNOWN_LOCATION);
}
--- 5111,5117 ----
var = gimple_phi_result (phi);
new_phi = create_phi_node (var, bb);
SSA_NAME_DEF_STMT (var) = new_phi;
! gimple_phi_set_result (phi, duplicate_ssa_name (var, phi));
add_phi_arg (new_phi, gimple_phi_result (phi), fallthru,
UNKNOWN_LOCATION);
}
Index: gcc/tree-into-ssa.c
===================================================================
*** gcc/tree-into-ssa.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-into-ssa.c 2012-08-03 10:54:15.688196147 +0200
*************** mark_for_renaming (tree sym)
*** 249,255 ****
static bool
marked_for_renaming (tree sym)
{
! if (!symbols_to_rename_set)
return false;
return bitmap_bit_p (symbols_to_rename_set, DECL_UID (sym));
}
--- 249,255 ----
static bool
marked_for_renaming (tree sym)
{
! if (!symbols_to_rename_set || sym == NULL_TREE)
return false;
return bitmap_bit_p (symbols_to_rename_set, DECL_UID (sym));
}
*************** prepare_block_for_update (basic_block bb
*** 2538,2544 ****
lhs_sym = DECL_P (lhs) ? lhs : SSA_NAME_VAR (lhs);
if (TREE_CODE (lhs) == SSA_NAME
! && (TREE_CODE (lhs_sym) != VAR_DECL
|| !VAR_DECL_IS_VIRTUAL_OPERAND (lhs_sym)
|| !cfun->gimple_df->rename_vops))
continue;
--- 2538,2545 ----
lhs_sym = DECL_P (lhs) ? lhs : SSA_NAME_VAR (lhs);
if (TREE_CODE (lhs) == SSA_NAME
! && (!lhs_sym
! || TREE_CODE (lhs_sym) != VAR_DECL
|| !VAR_DECL_IS_VIRTUAL_OPERAND (lhs_sym)
|| !cfun->gimple_df->rename_vops))
continue;
Index: gcc/tree-outof-ssa.c
===================================================================
*** gcc/tree-outof-ssa.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-outof-ssa.c 2012-08-03 10:54:15.689196147 +0200
*************** insert_backedge_copies (void)
*** 1078,1087 ****
/* Create a new instance of the underlying variable of the
PHI result. */
! stmt = gimple_build_assign (result_var,
gimple_phi_arg_def (phi, i));
- name = make_ssa_name (result_var, stmt);
- gimple_assign_set_lhs (stmt, name);
/* copy location if present. */
if (gimple_phi_arg_has_location (phi, i))
--- 1078,1086 ----
/* Create a new instance of the underlying variable of the
PHI result. */
! name = make_ssa_name (TREE_TYPE (result), NULL);
! stmt = gimple_build_assign (name,
gimple_phi_arg_def (phi, i));
/* copy location if present. */
if (gimple_phi_arg_has_location (phi, i))
Index: gcc/tree-ssa-forwprop.c
===================================================================
*** gcc/tree-ssa-forwprop.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-ssa-forwprop.c 2012-08-03 10:54:15.689196147 +0200
*************** simplify_bitwise_binary (gimple_stmt_ite
*** 1932,1945 ****
&& int_fits_type_p (arg2, TREE_TYPE (def1_arg1)))
{
gimple newop;
! tree tem = create_tmp_reg (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,
--- 1932,1943 ----
&& int_fits_type_p (arg2, TREE_TYPE (def1_arg1)))
{
gimple newop;
! 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));
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,
*************** simplify_bitwise_binary (gimple_stmt_ite
*** 1965,1975 ****
!= GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (arg1))))))
{
gimple newop;
! tree tem = create_tmp_reg (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,
--- 1963,1970 ----
!= GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (arg1))))))
{
gimple newop;
! tree tem = make_ssa_name (TREE_TYPE (def1_arg1), NULL);
newop = gimple_build_assign_with_ops (code, tem, def1_arg1, def2_arg1);
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,
*************** simplify_bitwise_binary (gimple_stmt_ite
*** 2011,2020 ****
{
gimple newop;
tree tem;
! tem = create_tmp_reg (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);
--- 2006,2013 ----
{
gimple newop;
tree tem;
! tem = make_ssa_name (TREE_TYPE (arg2), NULL);
newop = gimple_build_assign_with_ops (code, tem, a, c);
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);
*************** simplify_bitwise_binary (gimple_stmt_ite
*** 2042,2052 ****
update_stmt (stmt);
return true;
}
! tem = create_tmp_reg (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);
--- 2035,2043 ----
update_stmt (stmt);
return true;
}
! tem = make_ssa_name (TREE_TYPE (arg2), NULL);
newop = gimple_build_assign_with_ops (BIT_AND_EXPR,
tem, def1_arg1, arg2);
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);
Index: gcc/tree-ssa-structalias.c
===================================================================
*** gcc/tree-ssa-structalias.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-ssa-structalias.c 2012-08-03 10:54:15.690196147 +0200
*************** alias_get_name (tree decl)
*** 2676,2684 ****
if (TREE_CODE (decl) == SSA_NAME)
{
! num_printed = asprintf (&temp, "%s_%u",
! alias_get_name (SSA_NAME_VAR (decl)),
! SSA_NAME_VERSION (decl));
}
else if (DECL_P (decl))
{
--- 2676,2687 ----
if (TREE_CODE (decl) == SSA_NAME)
{
! if (SSA_NAME_VAR (decl))
! num_printed = asprintf (&temp, "%s_%u",
! alias_get_name (SSA_NAME_VAR (decl)),
! SSA_NAME_VERSION (decl));
! else
! num_printed = asprintf (&temp, "S.%u", SSA_NAME_VERSION (decl));
}
else if (DECL_P (decl))
{
Index: gcc/tree-ssa-uninit.c
===================================================================
*** gcc/tree-ssa-uninit.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-ssa-uninit.c 2012-08-03 10:54:15.690196147 +0200
*************** bool
*** 82,100 ****
ssa_undefined_value_p (tree t)
{
tree var = SSA_NAME_VAR (t);
!
/* Parameters get their initial value from the function entry. */
! if (TREE_CODE (var) == PARM_DECL)
return false;
-
/* When returning by reference the return address is actually a hidden
parameter. */
! if (TREE_CODE (SSA_NAME_VAR (t)) == RESULT_DECL
! && DECL_BY_REFERENCE (SSA_NAME_VAR (t)))
return false;
-
/* Hard register variables get their initial value from the ether. */
! if (TREE_CODE (var) == VAR_DECL && DECL_HARD_REGISTER (var))
return false;
/* The value is undefined iff its definition statement is empty. */
--- 82,98 ----
ssa_undefined_value_p (tree t)
{
tree var = SSA_NAME_VAR (t);
! if (!var)
! ;
/* Parameters get their initial value from the function entry. */
! else if (TREE_CODE (var) == PARM_DECL)
return false;
/* When returning by reference the return address is actually a hidden
parameter. */
! else if (TREE_CODE (var) == RESULT_DECL && DECL_BY_REFERENCE (var))
return false;
/* Hard register variables get their initial value from the ether. */
! else if (TREE_CODE (var) == VAR_DECL && DECL_HARD_REGISTER (var))
return false;
/* The value is undefined iff its definition statement is empty. */
Index: gcc/tree-flow-inline.h
===================================================================
*** gcc/tree-flow-inline.h.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-flow-inline.h 2012-08-03 10:54:15.690196147 +0200
*************** make_ssa_name (tree var, gimple stmt)
*** 1144,1149 ****
--- 1144,1162 ----
return make_ssa_name_fn (cfun, var, stmt);
}
+ /* Return an anonymous SSA_NAME node for type TYPE defined in statement STMT
+ in function cfun. Arrange so that it uses NAME in dumps. */
+
+ static inline tree
+ make_temp_ssa_name (tree type, gimple stmt, const char *name)
+ {
+ tree ssa_name;
+ gcc_checking_assert (TYPE_P (type));
+ ssa_name = make_ssa_name_fn (cfun, type, stmt);
+ SSA_NAME_IDENTIFIER (ssa_name) = get_identifier (name);
+ return ssa_name;
+ }
+
/* Returns the base object and a constant BITS_PER_UNIT offset in *POFFSET that
denotes the starting address of the memory access EXP.
Returns NULL_TREE if the offset is not constant or any component
Index: gcc/tree-pretty-print.c
===================================================================
*** gcc/tree-pretty-print.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-pretty-print.c 2012-08-03 10:54:15.691196147 +0200
*************** dump_generic_node (pretty_printer *buffe
*** 2043,2049 ****
break;
case SSA_NAME:
! dump_generic_node (buffer, SSA_NAME_VAR (node), spc, flags, false);
pp_string (buffer, "_");
pp_decimal_int (buffer, SSA_NAME_VERSION (node));
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
--- 2043,2053 ----
break;
case SSA_NAME:
! if (SSA_NAME_IDENTIFIER (node))
! dump_generic_node (buffer, SSA_NAME_IDENTIFIER (node),
! spc, flags, false);
! else
! pp_string (buffer, "<anon>");
pp_string (buffer, "_");
pp_decimal_int (buffer, SSA_NAME_VERSION (node));
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
Index: gcc/tree-ssa-loop-ivopts.c
===================================================================
*** gcc/tree-ssa-loop-ivopts.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-ssa-loop-ivopts.c 2012-08-03 11:07:53.300167837 +0200
*************** prepare_decl_rtl (tree *expr_p, int *ws,
*** 2828,2833 ****
--- 2828,2836 ----
case SSA_NAME:
*ws = 0;
obj = SSA_NAME_VAR (*expr_p);
+ /* Defer handling of anonymous SSA_NAMEs to the expander. */
+ if (!obj)
+ return NULL_TREE;
if (!DECL_RTL_SET_P (obj))
x = gen_raw_REG (DECL_MODE (obj), (*regno)++);
break;
*************** parm_decl_cost (struct ivopts_data *data
*** 4657,4662 ****
--- 4660,4666 ----
STRIP_NOPS (sbound);
if (TREE_CODE (sbound) == SSA_NAME
+ && SSA_NAME_VAR (sbound) != NULL_TREE
&& TREE_CODE (SSA_NAME_VAR (sbound)) == PARM_DECL
&& gimple_nop_p (SSA_NAME_DEF_STMT (sbound))
&& data->body_includes_call)
*************** determine_iv_cost (struct ivopts_data *d
*** 4981,4986 ****
--- 4985,4991 ----
The reason is to make debugging simpler; so this is not relevant for
artificial ivs created by other optimization passes. */
if (cand->pos != IP_ORIGINAL
+ || !SSA_NAME_VAR (cand->var_before)
|| DECL_ARTIFICIAL (SSA_NAME_VAR (cand->var_before)))
cost++;
Index: gcc/tree-ssa-loop-manip.c
===================================================================
*** gcc/tree-ssa-loop-manip.c.orig 2012-08-03 10:54:14.000000000 +0200
--- gcc/tree-ssa-loop-manip.c 2012-08-03 10:54:15.692196147 +0200
*************** tree_transform_and_unroll_loop (struct l
*** 1005,1014 ****
&& useless_type_conversion_p (TREE_TYPE (init),
TREE_TYPE (next)))
var = SSA_NAME_VAR (init);
! else if (useless_type_conversion_p (TREE_TYPE (next), TREE_TYPE (init)))
! var = create_tmp_var (TREE_TYPE (next), "unrinittmp");
! else
! var = create_tmp_var (TREE_TYPE (init), "unrinittmp");
new_init = make_ssa_name (var, NULL);
phi_rest = create_phi_node (new_init, rest);
--- 1005,1017 ----
&& useless_type_conversion_p (TREE_TYPE (init),
TREE_TYPE (next)))
var = SSA_NAME_VAR (init);
! if (!var)
! {
! if (useless_type_conversion_p (TREE_TYPE (next), TREE_TYPE (init)))
! var = create_tmp_var (TREE_TYPE (next), "unrinittmp");
! else
! var = create_tmp_var (TREE_TYPE (init), "unrinittmp");
! }
new_init = make_ssa_name (var, NULL);
phi_rest = create_phi_node (new_init, rest);
Index: gcc/lto-streamer-out.c
===================================================================
*** gcc/lto-streamer-out.c.orig 2012-07-24 10:35:57.000000000 +0200
--- gcc/lto-streamer-out.c 2012-08-03 11:13:57.251155243 +0200
*************** output_ssa_names (struct output_block *o
*** 619,625 ****
streamer_write_uhwi (ob, i);
streamer_write_char_stream (ob->main_stream,
SSA_NAME_IS_DEFAULT_DEF (ptr));
! stream_write_tree (ob, SSA_NAME_VAR (ptr), true);
}
streamer_write_zero (ob);
--- 619,629 ----
streamer_write_uhwi (ob, i);
streamer_write_char_stream (ob->main_stream,
SSA_NAME_IS_DEFAULT_DEF (ptr));
! if (SSA_NAME_VAR (ptr))
! stream_write_tree (ob, SSA_NAME_VAR (ptr), true);
! else
! /* ??? This drops SSA_NAME_IDENTIFIER on the floor. */
! stream_write_tree (ob, TREE_TYPE (ptr), true);
}
streamer_write_zero (ob);
Index: gcc/tree-inline.c
===================================================================
*** gcc/tree-inline.c.orig 2012-08-03 10:54:00.000000000 +0200
--- gcc/tree-inline.c 2012-08-03 11:20:48.073141013 +0200
*************** remap_ssa_name (tree name, copy_body_dat
*** 187,194 ****
if (processing_debug_stmt)
{
! if (TREE_CODE (SSA_NAME_VAR (name)) == PARM_DECL
! && SSA_NAME_IS_DEFAULT_DEF (name)
&& id->entry_bb == NULL
&& single_succ_p (ENTRY_BLOCK_PTR))
{
--- 187,194 ----
if (processing_debug_stmt)
{
! if (SSA_NAME_IS_DEFAULT_DEF (name)
! && TREE_CODE (SSA_NAME_VAR (name)) == PARM_DECL
&& id->entry_bb == NULL
&& single_succ_p (ENTRY_BLOCK_PTR))
{
*************** remap_ssa_name (tree name, copy_body_dat
*** 218,223 ****
--- 218,245 ----
return name;
}
+ /* Remap anonymous SSA names. */
+ if (!SSA_NAME_VAR (name))
+ {
+ struct ptr_info_def *pi;
+ new_tree = make_ssa_name (remap_type (TREE_TYPE (name), id), NULL);
+ if (SSA_NAME_IDENTIFIER (name))
+ SET_SSA_NAME_VAR (new_tree, SSA_NAME_IDENTIFIER (name));
+ insert_decl_map (id, name, new_tree);
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_tree)
+ = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name);
+ /* At least IPA points-to info can be directly transferred. */
+ if (id->src_cfun->gimple_df
+ && id->src_cfun->gimple_df->ipa_pta
+ && (pi = SSA_NAME_PTR_INFO (name))
+ && !pi->pt.anything)
+ {
+ struct ptr_info_def *new_pi = get_ptr_info (new_tree);
+ new_pi->pt = pi->pt;
+ }
+ return new_tree;
+ }
+
/* Do not set DEF_STMT yet as statement is not copied yet. We do that
in copy_bb. */
new_tree = remap_decl (SSA_NAME_VAR (name), id);
Index: gcc/tree-sra.c
===================================================================
*** gcc/tree-sra.c.orig 2012-08-02 13:39:40.000000000 +0200
--- gcc/tree-sra.c 2012-08-03 11:42:53.973095105 +0200
*************** replace_removed_params_ssa_names (gimple
*** 4237,4243 ****
if (TREE_CODE (lhs) != SSA_NAME)
return false;
decl = SSA_NAME_VAR (lhs);
! if (TREE_CODE (decl) != PARM_DECL)
return false;
adj = get_adjustment_for_base (adjustments, decl);
--- 4237,4243 ----
if (TREE_CODE (lhs) != SSA_NAME)
return false;
decl = SSA_NAME_VAR (lhs);
! if (!decl || TREE_CODE (decl) != PARM_DECL)
return false;
adj = get_adjustment_for_base (adjustments, decl);
Index: gcc/tree-ssa-uncprop.c
===================================================================
*** gcc/tree-ssa-uncprop.c.orig 2012-07-16 14:10:00.000000000 +0200
--- gcc/tree-ssa-uncprop.c 2012-08-03 11:56:18.549067245 +0200
*************** uncprop_into_successor_phis (basic_block
*** 463,468 ****
--- 463,469 ----
{
gimple phi = gsi_stmt (gsi);
tree arg = PHI_ARG_DEF (phi, e->dest_idx);
+ tree res = PHI_RESULT (phi);
struct equiv_hash_elt equiv_hash_elt;
void **slot;
*************** uncprop_into_successor_phis (basic_block
*** 470,476 ****
underlying variable as the PHI result, then there's no
point in un-propagating the argument. */
if (!is_gimple_min_invariant (arg)
! && SSA_NAME_VAR (arg) != SSA_NAME_VAR (PHI_RESULT (phi)))
continue;
/* Lookup this argument's value in the hash table. */
--- 471,477 ----
underlying variable as the PHI result, then there's no
point in un-propagating the argument. */
if (!is_gimple_min_invariant (arg)
! && SSA_NAME_VAR (arg) == SSA_NAME_VAR (res))
continue;
/* Lookup this argument's value in the hash table. */
*************** uncprop_into_successor_phis (basic_block
*** 492,498 ****
{
tree equiv = VEC_index (tree, elt->equivalences, j);
! if (SSA_NAME_VAR (equiv) == SSA_NAME_VAR (PHI_RESULT (phi)))
{
SET_PHI_ARG_DEF (phi, e->dest_idx, equiv);
break;
--- 493,501 ----
{
tree equiv = VEC_index (tree, elt->equivalences, j);
! if (SSA_NAME_VAR (equiv) == SSA_NAME_VAR (res)
! && useless_type_conversion_p (TREE_TYPE (res),
! TREE_TYPE (equiv)))
{
SET_PHI_ARG_DEF (phi, e->dest_idx, equiv);
break;