------- Additional Comments From steven at gcc dot gnu dot org  2005-05-12 
10:23 -------
The failure I mentioned in comment #7 is caused by remove_dead_inserted_code, 
which removes the statement setting that SSA name: 
 
In the .pre dump file: 
Removing unnecessary insertion:pretmp.308_35 = (unsigned char *)pretmp.307_36; 
 
And the ICE message: 
error: Missing definition for SSA_NAME: pretmp.308_35 in statement: 
 
That remove_dead_inserted_code passlet doesn't work very well anyway, for 
the original test case we also have dead code in the .pre dump: 
 
do_locator1 (call) 
{ 
  int prephitmp.4; 
  int pretmp.3; 
  char prephitmp.2; 
  char pretmp.1; 
  int type; 
  char D.1566; 
  int D.1565; 
 
<bb 0>: 
  if (call_3 != 0B) goto <L0>; else goto <L4>; 
 
<L4>:; 
  goto <bb 2> (<L1>); 
 
<L0>:; 
  type_7 = *call_3; 
  pretmp.1_2 = (char) type_7; 
  pretmp.3_10 = (int) pretmp.1_2; 
 
  # prephitmp.4_11 = PHI <1(3), pretmp.3_10(1)>; 
  # prephitmp.2_9 = PHI <1(3), pretmp.1_2(1)>; 
  # type_1 = PHI <1(3), type_7(1)>; 
<L1>:; 
  D.1566_4 = prephitmp.2_9; 
  D.1565_5 = prephitmp.4_11; 
  return D.1565_5; 
 
} 
 
It may be better to just not have this ad-hoc DCE and move a real DCE pass 
up in the pass schedule -- something like this: 
 
Index: tree-optimize.c 
=================================================================== 
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v 
retrieving revision 2.90 
diff -u -3 -p -r2.90 tree-optimize.c 
--- tree-optimize.c     11 May 2005 02:24:42 -0000      2.90 
+++ tree-optimize.c     12 May 2005 09:09:53 -0000 
@@ -405,10 +405,10 @@ init_tree_optimization_passes (void) 
   NEXT_PASS (pass_split_crit_edges); 
   NEXT_PASS (pass_pre); 
   NEXT_PASS (pass_sink_code); 
+  NEXT_PASS (pass_dce); 
   NEXT_PASS (pass_loop); 
   NEXT_PASS (pass_dominator); 
   NEXT_PASS (pass_copy_prop); 
-  NEXT_PASS (pass_dce); 
   /* FIXME: If DCE is not run before checking for uninitialized uses, 
      we may get false warnings (e.g., testsuite/gcc.dg/uninit-5.c). 
      However, this also causes us to misdiagnose cases that should be 
@@ -418,8 +418,8 @@ init_tree_optimization_passes (void) 
      account for the predicates protecting the set and the use of each 
      variable.  Using a representation like Gated Single Assignment 
      may help.  */ 
-  NEXT_PASS (pass_late_warn_uninitialized); 
   NEXT_PASS (pass_cd_dce); 
+  NEXT_PASS (pass_late_warn_uninitialized); 
   NEXT_PASS (pass_dse); 
   NEXT_PASS (pass_forwprop); 
   NEXT_PASS (pass_phiopt); 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21520

Reply via email to