[lno] Some bugfixes
Zdenek Dvorak
rakdver@atrey.karlin.mff.cuni.cz
Wed Mar 31 22:18:00 GMT 2004
Hello,
this patch fixes several bugs in ivopts revealed by enabling it during
compilation of libstc++ and libjava. It should also help the eon
failure reported by Dorit.
Zdenek
Index: ChangeLog.lno
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ChangeLog.lno,v
retrieving revision 1.1.2.112
diff -c -3 -p -r1.1.2.112 ChangeLog.lno
*** ChangeLog.lno 31 Mar 2004 18:41:33 -0000 1.1.2.112
--- ChangeLog.lno 31 Mar 2004 22:14:38 -0000
***************
*** 1,5 ****
--- 1,17 ----
2004-03-31 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+ * tree-into-ssa.c (ssa_rewrite_initialize_block): Update
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI.
+ (ssa_rewrite_phi_arguments): Ditto.
+ * tree-ssa.c (kill_redundant_phi_nodes): Prevent replacing
+ ssa names that occur in abnormal phi nodes.
+ * tree-ssa-loop-ivopts.c (get_var_def): Handle non-invariant
+ non-ssa name operands.
+ * java/decl.c (java_init_decl_processing): Initialize
+ long_integer_type_node.
+
+ 2004-03-31 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
* tree-ssa-loop-ivopts.c (idx_find_step): Prevent misscompilation
in case the index overflows.
Index: tree-into-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-into-ssa.c,v
retrieving revision 1.1.4.2
diff -c -3 -p -r1.1.4.2 tree-into-ssa.c
*** tree-into-ssa.c 27 Mar 2004 18:29:36 -0000 1.1.4.2
--- tree-into-ssa.c 31 Mar 2004 22:08:23 -0000
*************** ssa_rewrite_initialize_block (struct dom
*** 737,746 ****
--- 737,753 ----
struct rewrite_block_data *bd
= (struct rewrite_block_data *)VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack);
bitmap names_to_rename = walk_data->global_data;
+ edge e;
+ bool abnormal_phi;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\n\nRenaming block #%d\n\n", bb->index);
+ for (e = bb->pred; e; e = e->pred_next)
+ if (e->flags & EDGE_ABNORMAL)
+ break;
+ abnormal_phi = (e != NULL);
+
/* Step 1. Register new definitions for every PHI node in the block.
Conceptually, all the PHI nodes are executed in parallel and each PHI
node introduces a new version for the associated variable. */
*************** ssa_rewrite_initialize_block (struct dom
*** 752,757 ****
--- 759,767 ----
{
new_name = duplicate_ssa_name (result, phi);
PHI_RESULT (phi) = new_name;
+
+ if (abnormal_phi)
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_name) = 1;
}
else
new_name = result;
*************** ssa_rewrite_phi_arguments (struct dom_wa
*** 817,822 ****
--- 827,834 ----
continue;
*op = get_reaching_def (*op);
+ if (e->flags & EDGE_ABNORMAL)
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI (*op) = 1;
}
}
}
Index: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-loop-ivopts.c,v
retrieving revision 1.1.2.22
diff -c -3 -p -r1.1.2.22 tree-ssa-loop-ivopts.c
*** tree-ssa-loop-ivopts.c 31 Mar 2004 18:41:33 -0000 1.1.2.22
--- tree-ssa-loop-ivopts.c 31 Mar 2004 22:08:23 -0000
*************** get_var_def (struct ivopts_data *data, t
*** 1186,1191 ****
--- 1186,1194 ----
return true;
}
+ if (TREE_CODE (var) != SSA_NAME)
+ return false;
+
iv = get_iv (data, var);
if (!iv)
return false;
Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa.c,v
retrieving revision 1.1.4.180.2.6
diff -c -3 -p -r1.1.4.180.2.6 tree-ssa.c
*** tree-ssa.c 21 Mar 2004 03:20:23 -0000 1.1.4.180.2.6
--- tree-ssa.c 31 Mar 2004 22:08:24 -0000
*************** kill_redundant_phi_nodes (void)
*** 846,851 ****
--- 846,858 ----
ver = SSA_NAME_VERSION (var);
ssa_names[ver] = var;
+ if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (var))
+ {
+ /* Prevent copy propagation from replacing this ssa name. */
+ raise_value (phi, var, eq_to);
+ continue;
+ }
+
for (i = 0; i < (unsigned) PHI_NUM_ARGS (phi); i++)
{
t = PHI_ARG_DEF (phi, i);
*************** kill_redundant_phi_nodes (void)
*** 860,871 ****
aver = SSA_NAME_VERSION (t);
ssa_names[aver] = t;
/* If the defining statement for this argument is not a
! phi node or the argument is associated with an abnormal
! edge, then we need to recursively start the forward
dataflow starting with PHI. */
! if (TREE_CODE (stmt) != PHI_NODE
! || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (t))
{
eq_to[aver] = t;
raise_value (phi, t, eq_to);
--- 867,884 ----
aver = SSA_NAME_VERSION (t);
ssa_names[aver] = t;
+ /* If the argument is associated with an abnormal edge,
+ we cannot allow it being copy propagated. */
+ if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (t))
+ {
+ raise_value (phi, var, eq_to);
+ break;
+ }
+
/* If the defining statement for this argument is not a
! phi node, we need to recursively start the forward
dataflow starting with PHI. */
! if (TREE_CODE (stmt) != PHI_NODE)
{
eq_to[aver] = t;
raise_value (phi, t, eq_to);
Index: java/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/decl.c,v
retrieving revision 1.128.2.32.2.2
diff -c -3 -p -r1.128.2.32.2.2 decl.c
*** java/decl.c 21 Feb 2004 23:12:18 -0000 1.128.2.32.2.2
--- java/decl.c 31 Mar 2004 22:08:26 -0000
*************** java_init_decl_processing (void)
*** 490,495 ****
--- 490,496 ----
/* Define these next since types below may used them. */
integer_type_node = java_type_for_size (INT_TYPE_SIZE, 0);
+ long_integer_type_node = java_type_for_size (LONG_TYPE_SIZE, 0);
integer_zero_node = build_int_2 (0, 0);
integer_one_node = build_int_2 (1, 0);
integer_two_node = build_int_2 (2, 0);
More information about the Gcc-patches
mailing list