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

[PATCH] Restore bootstrap (PR61757)

The following patch partially reverts r212352 to restore bootstrap
on i585-linux (where I reproduced and verified the fix).  It makes
phicprop honor that loop-depth condition again which doing not
seems to cause a latent bug to pop up which miscompiles the stage2
compiler which in turn miscompiles stage3 genmodes.

I don't have time to track down the failure thus the revert below.

Also bootstrapped and tested on x86_64-unknown-linux-gnu, applied.


2014-07-10  Richard Biener  <>

	PR tree-optimization/61757
	* tree-ssa-dom.c (loop_depth_of_name): Restore.
	(propagate_rhs_into_lhs): Revert part of last change.

Index: gcc/tree-ssa-dom.c
--- gcc/tree-ssa-dom.c	(revision 212352)
+++ gcc/tree-ssa-dom.c	(working copy)
@@ -2639,6 +2639,33 @@ get_lhs_or_phi_result (gimple stmt)
     gcc_unreachable ();
+/* Return the loop depth of the basic block of the defining statement of X.
+   This number should not be treated as absolutely correct because the loop
+   information may not be completely up-to-date when dom runs.  However, it
+   will be relatively correct, and as more passes are taught to keep loop info
+   up to date, the result will become more and more accurate.  */
+static int
+loop_depth_of_name (tree x)
+  gimple defstmt;
+  basic_block defbb;
+  /* If it's not an SSA_NAME, we have no clue where the definition is.  */
+  if (TREE_CODE (x) != SSA_NAME)
+    return 0;
+  /* Otherwise return the loop depth of the defining statement's bb.
+     Note that there may not actually be a bb for this statement, if the
+     ssa_name is live on entry.  */
+  defstmt = SSA_NAME_DEF_STMT (x);
+  defbb = gimple_bb (defstmt);
+  if (!defbb)
+    return 0;
+  return bb_loop_depth (defbb);
 /* Propagate RHS into all uses of LHS (when possible).
    RHS and LHS are derived from STMT, which is passed in solely so
@@ -2654,7 +2681,8 @@ static void
 propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_names)
   /* First verify that propagation is valid.  */
-  if (may_propagate_copy (lhs, rhs))
+  if (may_propagate_copy (lhs, rhs)
+      && loop_depth_of_name (lhs) >= loop_depth_of_name (rhs))
       use_operand_p use_p;
       imm_use_iterator iter;

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