This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] bootstrap comparison failure on ppc and ppc64


Jeff,

Undoing your patch allowed me to bootstrap again on ppc32.  I'm not
bootstrapping on my lame ppc box anymore, so I think this is
reproduceable, but just in case, could you try bootstrapping on your ppc
box?

We're having spurious bootstrap problems on ppc which I think are
related to aliasing.  I wish I could nail it down, but it's proving
annoying to fix.


Thanks.  Diego.


diff -r -x CVS -dupN gcc.prev/gcc/tree-cfg.c gcc/gcc/tree-cfg.c
--- gcc.prev/gcc/tree-cfg.c	2003-07-26 00:02:42.000000000 -0400
+++ gcc/gcc/tree-cfg.c	2003-07-29 00:03:16.000000000 -0400
@@ -4458,19 +4458,33 @@ move_outgoing_edges (basic_block bb1, ba
       old_edge = bb2->succ;
       new_edge = make_edge (bb1, old_edge->dest, old_edge->flags);
 
-      /* Update PHI nodes at BB2's successor.  The arguments that used to
-	 come from BB2 now come from BB1.  */
-      for (phi = phi_nodes (old_edge->dest); phi; phi = TREE_CHAIN (phi))
+      /* If make_edge created a new edge, then we need to update the PHI
+	 node at BB2's successor.  The arguments that used to come from
+	 BB2 now come from BB1.
+
+	 If make_edge did not create a new edge, then we already had an
+	 edge from BB1 to BB2's successor.  In this case we want to
+	 remove the edge and remove its alternative from BB2's successor's
+	 PHI nodes, hence we use ssa_remove_edge.  */
+      if (new_edge)
 	{
-	  int i;
-	  for (i = 0; i < PHI_NUM_ARGS (phi); i++)
-	    if (PHI_ARG_EDGE (phi, i) == old_edge)
-	      PHI_ARG_EDGE (phi, i) = new_edge;
+	  for (phi = phi_nodes (old_edge->dest); phi; phi = TREE_CHAIN (phi))
+	    {
+	      int i;
+	      for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+		if (PHI_ARG_EDGE (phi, i) == old_edge)
+		  PHI_ARG_EDGE (phi, i) = new_edge;
+	    }
+
+	  /* Note that we shouldn't call ssa_remove_edge here because we've
+	     already dealt with PHI nodes.  */
+	  remove_edge (old_edge);
+	}
+      else
+	{
+	  ssa_remove_edge (old_edge);
 	}
 
-      /* Note that we shouldn't call ssa_remove_edge here because we've
-	 already dealt with PHI nodes.  */
-      remove_edge (old_edge);
     }
 
   /* BB2's dominator children are now BB1's.  Also, remove BB2 as a
diff -r -x CVS -dupN gcc.prev/gcc/tree-dfa.c gcc/gcc/tree-dfa.c
--- gcc.prev/gcc/tree-dfa.c	2003-07-24 23:13:07.000000000 -0400
+++ gcc/gcc/tree-dfa.c	2003-07-29 00:03:16.000000000 -0400
@@ -1048,9 +1048,14 @@ compute_immediate_uses_for (tree stmt, i
 
       for (i = 0; i < PHI_NUM_ARGS (stmt); i++)
 	{
-	  tree imm_rdef_stmt = SSA_NAME_DEF_STMT (PHI_ARG_DEF (stmt, i));
-	  if (!IS_EMPTY_STMT (imm_rdef_stmt))
-	    add_immediate_use (imm_rdef_stmt, stmt);
+	  tree arg = PHI_ARG_DEF (stmt, i);
+
+	  if (TREE_CODE (arg) == SSA_NAME)
+	    { 
+	      tree imm_rdef_stmt = SSA_NAME_DEF_STMT (PHI_ARG_DEF (stmt, i));
+	      if (!IS_EMPTY_STMT (imm_rdef_stmt))
+		add_immediate_use (imm_rdef_stmt, stmt);
+	    }
 	}
       return;
     }
diff -r -x CVS -dupN gcc.prev/gcc/tree-flow-inline.h gcc/gcc/tree-flow-inline.h
--- gcc.prev/gcc/tree-flow-inline.h	2003-07-23 19:48:15.000000000 -0400
+++ gcc/gcc/tree-flow-inline.h	2003-07-29 00:03:16.000000000 -0400
@@ -540,7 +540,8 @@ static inline bool
 may_propagate_copy (tree dest, tree orig)
 {
   return (!SSA_NAME_OCCURS_IN_ABNORMAL_PHI (dest)
-	  && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig)
+	  && (TREE_CONSTANT (orig)
+	      || !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig))
 	  && !DECL_HARD_REGISTER (SSA_NAME_VAR (dest)));
 }
 
diff -r -x CVS -dupN gcc.prev/gcc/tree-ssa-ccp.c gcc/gcc/tree-ssa-ccp.c
--- gcc.prev/gcc/tree-ssa-ccp.c	2003-07-22 14:36:38.000000000 -0400
+++ gcc/gcc/tree-ssa-ccp.c	2003-07-29 00:03:16.000000000 -0400
@@ -398,7 +398,19 @@ visit_phi_node (tree phi)
 	if (e->flags & EDGE_EXECUTABLE)
 	  {
 	    tree rdef = PHI_ARG_DEF (phi, i);
-	    value *rdef_val = get_value (rdef);
+	    value *rdef_val;
+
+	    if (TREE_CONSTANT (rdef))
+	      {
+		value val;
+
+		val.lattice_val = CONSTANT;
+		val.const_val = rdef;
+		rdef_val = &val;
+	      }
+	    else
+	      rdef_val = get_value (rdef);
+
 	    phi_val = cp_lattice_meet (phi_val, *rdef_val);
 
 	    if (dump_file && (dump_flags & TDF_DETAILS))
diff -r -x CVS -dupN gcc.prev/gcc/tree-ssa-copyprop.c gcc/gcc/tree-ssa-copyprop.c
--- gcc.prev/gcc/tree-ssa-copyprop.c	2003-07-23 19:48:16.000000000 -0400
+++ gcc/gcc/tree-ssa-copyprop.c	2003-07-29 00:03:16.000000000 -0400
@@ -150,11 +150,13 @@ copyprop_phi (tree phi)
   for (i = 0; i < PHI_NUM_ARGS (phi); i++)
     {
       tree arg = PHI_ARG_DEF (phi, i);
-      tree orig = get_original (arg);
+      tree orig;
 
-      if (orig
-	  && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (arg)
-	  && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig))
+      if (TREE_CODE (arg) != SSA_NAME)
+	continue;
+
+      orig = get_original (arg);
+      if (orig && may_propagate_copy (arg, orig))
 	{
 	  if (dump_file && dump_flags & TDF_DETAILS)
 	    {
diff -r -x CVS -dupN gcc.prev/gcc/tree-ssa-dce.c gcc/gcc/tree-ssa-dce.c
--- gcc.prev/gcc/tree-ssa-dce.c	2003-07-21 22:50:15.000000000 -0400
+++ gcc/gcc/tree-ssa-dce.c	2003-07-29 00:03:17.000000000 -0400
@@ -357,7 +357,11 @@ process_worklist (void)
 	  /* All the statements feeding this PHI node's arguments are
 	     necessary.  */
 	  for (k = 0; k < PHI_NUM_ARGS (i); k++)
-	    mark_necessary (SSA_NAME_DEF_STMT (PHI_ARG_DEF (i, k)));
+	    {
+	      tree arg = PHI_ARG_DEF (i, k);
+	      if (TREE_CODE (arg) == SSA_NAME)
+		mark_necessary (SSA_NAME_DEF_STMT (PHI_ARG_DEF (i, k)));
+	    }
 
 	  /* Look at all the predecessors, and if this PHI is being fed
 	     from a conditional expression, mark that conditional
diff -r -x CVS -dupN gcc.prev/gcc/tree-ssa-dom.c gcc/gcc/tree-ssa-dom.c
--- gcc.prev/gcc/tree-ssa-dom.c	2003-07-26 00:02:42.000000000 -0400
+++ gcc/gcc/tree-ssa-dom.c	2003-07-29 00:03:17.000000000 -0400
@@ -261,7 +261,8 @@ optimize_block (basic_block bb, tree par
      creates an equivalence we can record into the const_and_copies table.  */
   for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
     if (PHI_NUM_ARGS (phi) == 1
-	&& TREE_CODE (PHI_ARG_DEF (phi, 0)) == SSA_NAME
+	&& (TREE_CODE (PHI_ARG_DEF (phi, 0)) == SSA_NAME
+	    || TREE_CONSTANT (PHI_ARG_DEF (phi, 0)))
 	&& may_propagate_copy (PHI_RESULT (phi), PHI_ARG_DEF (phi, 0)))
       set_value_for (PHI_RESULT (phi), PHI_ARG_DEF (phi, 0), const_and_copies);
 
@@ -286,12 +287,12 @@ optimize_block (basic_block bb, tree par
 		  if (! SSA_VAR_P (*orig_p))
 		    break;
 
-		  /* FIXME.  We should be able to propagate constants into
-		     PHI nodes in the not too distant future.  */
 		  new = get_value_for (*orig_p, const_and_copies);
+		  /* We want to allow copy propagation as well as constant
+		     propagation.  */
 		  if (new
-		      && TREE_CODE (new) == SSA_NAME
-		      && may_propagate_copy (new, *orig_p))
+		      && (TREE_CODE (new) == SSA_NAME || TREE_CONSTANT (new))
+		      && may_propagate_copy (*orig_p, new))
 		    *orig_p = new;
 		  break;
 		}




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]