This is the mail archive of the gcc-patches@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]

[tree-ssa][PATCH]: Stop PRE from extending lifetimes across abnormaledges or inserting on them


I know this fixes Gerald's testcase, i'm currently bootstrapping it on x86
and powerpc.

If it passes, i'll commit it.

2003-09-10  Daniel Berlin  <dberlin@dberlin.org>

	* tree-ssa-pre.c (ephi_has_bottom): Remove dead function.
	(ephi_has_unsafe_arg): New function.
	(compute_down_safety): Use it.
	(reset_down_safe): Continue search on abnormal edges, too.

Index: tree-ssa-pre.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-pre.c,v
retrieving revision 1.1.4.79
diff -u -3 -p -w -B -b -r1.1.4.79 tree-ssa-pre.c
--- tree-ssa-pre.c	10 Sep 2003 13:24:36 -0000	1.1.4.79
+++ tree-ssa-pre.c	10 Sep 2003 21:26:51 -0000
@@ -145,6 +145,7 @@ static void insert_euse_in_preorder_dt_o
 #if ENABLE_CHECKING
 static int count_stmts_in_bb (basic_block);
 #endif
+static bool ephi_has_unsafe_arg (tree);
 static void reset_down_safe (tree, int);
 static void compute_down_safety (struct expr_info *);
 static void compute_will_be_avail (struct expr_info *);
@@ -217,7 +218,6 @@ static tree reaching_def (tree, tree, ba
 static tree do_proper_save (tree , tree, int);
 static void process_left_occs_and_kills (varray_type, struct expr_info *,
                                          tree);
-static inline bool ephi_has_bottom (tree);
 static int add_call_to_ei (struct expr_info *, void *);
 static bool call_modifies_slot (tree, tree);
 static tree create_expr_ref (struct expr_info *, tree, enum tree_code,
@@ -505,19 +505,6 @@ factor_through_injuries (struct expr_inf
   return end;
 }

-/* Returns true if the EPHI has a NULL argument.  */
-static inline bool
-ephi_has_bottom (tree ephi)
-{
-  int i;
-  for (i = 0 ; i < EPHI_NUM_ARGS (ephi); i++)
-    {
-      if (EPHI_ARG_DEF (ephi, i) == NULL_TREE)
-	return true;
-    }
-  return false;
-}
-
 /* Return true if an EPHI will be available.  */
 static inline bool
 ephi_will_be_avail (tree ephi)
@@ -1330,6 +1317,18 @@ rename_1 (struct expr_info *ei)
   }
 }

+/* Determine if the EPHI has an argument we could never insert
+   or extend the lifetime of, such as an argument occurring on
+   an abnormal edge. */
+static bool
+ephi_has_unsafe_arg (tree ephi)
+{
+  int i;
+  for (i = 0; i < EPHI_NUM_ARGS (ephi); i++)
+    if (EPHI_ARG_EDGE (ephi, i)->flags & EDGE_ABNORMAL)
+      return true;
+  return false;
+}

 /* Reset down safety flags for non-downsafe ephis. Uses depth first
    search.  */
@@ -1339,7 +1338,8 @@ reset_down_safe (tree currphi, int opnum
   tree ephi;
   int i;

-  if (EPHI_ARG_HAS_REAL_USE (currphi, opnum))
+  if (EPHI_ARG_HAS_REAL_USE (currphi, opnum)
+      && !(EPHI_ARG_EDGE (currphi, opnum)->flags & EDGE_ABNORMAL))
     return;
   ephi = EPHI_ARG_DEF (currphi, opnum);
   if (!ephi || TREE_CODE (ephi) != EPHI_NODE)
@@ -1356,6 +1356,15 @@ static void
 compute_down_safety (struct expr_info *ei)
 {
   size_t i;
+  basic_block bb;
+  FOR_EACH_BB (bb)
+  {
+    tree ephi = ephi_at_block (bb);
+    if (ephi == NULL_TREE)
+      continue;
+    if (ephi_has_unsafe_arg (ephi))
+      EPHI_DOWNSAFE (ephi) = false;
+  }
   for (i = 0; i < VARRAY_ACTIVE_SIZE (ei->euses_dt_order); i++)
     {
       int j;
@@ -2136,7 +2145,6 @@ finalize_2 (struct expr_info *ei)
 	}
     }
   do_ephi_df_search (ei, replacing_search);
-
 }

 /* Perform a DFS on EPHI using the functions in SEARCH. */


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