[rfa] Fix PR44699: bootstrap problem

Michael Matz matz@suse.de
Wed Jun 30 17:10:00 GMT 2010


Hi,

On Wed, 30 Jun 2010, Dominique Dhumieres wrote:

> With the patches in
> 
> http://gcc.gnu.org/ml/gcc-patches/2010-06/msg03011.html
> http://gcc.gnu.org/ml/gcc-patches/2010-06/msg03122.html
> 
> plus my fix for pr44726, I am now finishing to bootstrap
> trunk at revision 161606 (currently building libjava).

Okay, super.  If you run the testsuite you'll probably notice a FAIL 
relating to "expecting ssa_name but got var_decl" or similar.  I've fixed 
that in the checked in version (r161614 btw).

FWIW, I've had to guard the assignment to SSA_NAME_DEF_STMT with a check 
for gimple_vdef(stmt) being an SSA_NAME, as we might get called on 
statements that aren't fully updated already.  The final gimple-fold.c 
change I've checked in is below (the rest was as posted already).

I'm going to cleanup that function somewhat later, as promised.


Ciao,
Michael.
-- 
Index: gimple-fold.c
===================================================================
--- gimple-fold.c	(revision 161613)
+++ gimple-fold.c	(revision 161614)
@@ -1133,7 +1133,8 @@ gimplify_and_update_call_from_tree (gimp
       if (gimple_vdef (stmt) && laststore)
 	{
 	  gimple_set_vdef (laststore, gimple_vdef (stmt));
-	  move_ssa_defining_stmt_for_defs (laststore, stmt);
+	  if (TREE_CODE (gimple_vdef (stmt)) == SSA_NAME)
+	    SSA_NAME_DEF_STMT (gimple_vdef (stmt)) = laststore;
 	  update_stmt (laststore);
 	}
       else
@@ -1150,7 +1151,15 @@ gimplify_and_update_call_from_tree (gimp
 	  gsi_insert_before (si_p, last, GSI_NEW_STMT);
 	  gsi_next (si_p);
 	}
-      if (laststore)
+      if (laststore && is_gimple_reg (lhs))
+	{
+	  gimple_set_vdef (laststore, gimple_vdef (stmt));
+	  update_stmt (laststore);
+	  if (TREE_CODE (gimple_vdef (stmt)) == SSA_NAME)
+	    SSA_NAME_DEF_STMT (gimple_vdef (stmt)) = laststore;
+	  laststore = NULL;
+	}
+      else if (laststore)
 	{
 	  reaching_vuse = make_ssa_name (gimple_vop (cfun), laststore);
 	  gimple_set_vdef (laststore, reaching_vuse);
@@ -1158,9 +1167,14 @@ gimplify_and_update_call_from_tree (gimp
 	  laststore = NULL;
 	}
       new_stmt = gimple_build_assign (lhs, tmp);
-      gimple_set_vuse (new_stmt, reaching_vuse);
-      gimple_set_vdef (new_stmt, gimple_vdef (stmt));
-      move_ssa_defining_stmt_for_defs (new_stmt, stmt);
+      if (!is_gimple_reg (tmp))
+	gimple_set_vuse (new_stmt, reaching_vuse);
+      if (!is_gimple_reg (lhs))
+	{
+	  gimple_set_vdef (new_stmt, gimple_vdef (stmt));
+	  if (TREE_CODE (gimple_vdef (stmt)) == SSA_NAME)
+	    SSA_NAME_DEF_STMT (gimple_vdef (stmt)) = new_stmt;
+	}
     }
 
   gimple_set_location (new_stmt, gimple_location (stmt));



More information about the Gcc-patches mailing list