tree-ssa-dom.c (thread_across_edge): Do not thread jumps if a PHI argument is set...
authorJeff Law <law@redhat.com>
Mon, 13 Dec 2004 20:12:33 +0000 (13:12 -0700)
committerJeff Law <law@gcc.gnu.org>
Mon, 13 Dec 2004 20:12:33 +0000 (13:12 -0700)
* tree-ssa-dom.c (thread_across_edge): Do not thread jumps if a
PHI argument is set from a PHI_RESULT in the same block and the
PHI argument is not the same as the PHI result.

Co-Authored-By: Kazu Hirata <kazu@cs.umass.edu>
From-SVN: r92102

gcc/ChangeLog
gcc/tree-ssa-dom.c

index 96a1648fb078e452fad892a812501a362b7c334c..85e7719fc86d1a349e64dae9f66917cfccaa32fe 100644 (file)
@@ -1,3 +1,10 @@
+2004-12-13  Jeff Law  <law@redhat.com>
+            Kazu Hirata  <kazu@cs.umass.edu>
+
+       * tree-ssa-dom.c (thread_across_edge): Do not thread jumps if a
+       PHI argument is set from a PHI_RESULT in the same block and the
+       PHI argument is not the same as the PHI result.
+
 2004-12-13  David Edelsohn  <edelsohn@gnu.org>
 
        * xcoffout.c (xcoffout_declare_function): Always strip storage
index 3a3bdada4d884eb0a3fc6d19bb61c60b657fd39d..81fdb0e8652eeaf51188f902659b56e684ef5424 100644 (file)
@@ -550,6 +550,16 @@ thread_across_edge (struct dom_walk_data *walk_data, edge e)
     {
       tree src = PHI_ARG_DEF_FROM_EDGE (phi, e);
       tree dst = PHI_RESULT (phi);
+
+      /* If the desired argument is not the same as this PHI's result 
+        and it is set by a PHI in this block, then we can not thread
+        through this block.  */
+      if (src != dst
+         && TREE_CODE (src) == SSA_NAME
+         && TREE_CODE (SSA_NAME_DEF_STMT (src)) == PHI_NODE
+         && bb_for_stmt (SSA_NAME_DEF_STMT (src)) == e->dest)
+       return;
+
       record_const_or_copy (dst, src);
       register_new_def (dst, &block_defs_stack);
     }