LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File nov161594.diff of Package gcc33 (Project openSUSE:Factory)

Index: gcc/gcse.c
===================================================================
--- gcc/gcse.c.orig
+++ gcc/gcse.c
@@ -688,7 +688,6 @@ static void find_moveable_store		PARAMS 
 static int compute_store_table		PARAMS ((void));
 static bool load_kills_store		PARAMS ((rtx, rtx, int));
 static bool find_loads			PARAMS ((rtx, rtx, int));
-static bool local_variable_p (struct ls_expr *ptr);
 static bool store_killed_in_insn	PARAMS ((rtx, rtx, rtx, int));
 static bool store_killed_after		PARAMS ((rtx, rtx, rtx, basic_block,
 						 int *, rtx *));
@@ -7298,25 +7297,6 @@ find_loads (x, store_pattern, after)
   return ret;
 }
 
-/* Checks if mem in PTR corresponds to a local variable.  */
-static bool
-local_variable_p (struct ls_expr *ptr)
-{
-  rtx base;
-      
-  /* This optimization is performed by faking a store to the
-     memory at the end of the block.  This doesn't work for
-     unchanging memories because multiple stores to unchanging
-     memory is illegal and alias analysis doesn't consider it.  */
-  if (RTX_UNCHANGING_P (ptr->pattern))
-    return 0;
-  base = find_base_term (XEXP (ptr->pattern, 0));
-  return (base
-	  && GET_CODE (base) == ADDRESS
-	  && GET_MODE (base) == Pmode
-	  && XEXP (base, 0) == frame_pointer_rtx);
-}
-
 /* Check if INSN kills the store pattern X (is aliased with it).
    AFTER is true if we are checking the case when store X occurs
    after the insn.  Return true if it it does.  */
@@ -7540,14 +7520,17 @@ build_store_vectors ()
 
       for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
 	{
-	  /* If this is a reference to a local variable, add the fake store
-	     before end of function.  This takes care of dead code ellimination
-	     for them.  */
-	  if (!local_variable_p (ptr))
-	    continue;
-
-	  if (!TEST_BIT (ae_kill[bb->index], ptr->index))
-	    SET_BIT (st_antloc[bb->index], ptr->index);
+	  if (store_killed_after (ptr->pattern, ptr->pattern_regs, BB_HEAD (bb),
+				  bb, regs_set_in_block, NULL))
+	    {
+	      /* It should not be necessary to consider the expression
+		 killed if it is both anticipatable and available.  */
+	      if (!TEST_BIT (st_antloc[bb->index], ptr->index)
+		  || !TEST_BIT (ae_gen[bb->index], ptr->index))
+		SET_BIT (ae_kill[bb->index], ptr->index);
+	    }
+	  else
+	    SET_BIT (transp[bb->index], ptr->index);
 	}
     }