2005-01-20 Daniel Berlin <dberlin@dberlin.org>
authordberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 22 Jan 2005 16:48:23 +0000 (16:48 +0000)
committerdberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 22 Jan 2005 16:48:23 +0000 (16:48 +0000)
Fix PR tree-optimization/19038
* tree-ssa-dom.c (cprop_operand): Don't replace loop invaeriant
copies with loop variant ones.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94069 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 73db887..1a9d9e6 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-20  Daniel Berlin  <dberlin@dberlin.org>
+
+       Fix PR tree-optimization/19038
+       * tree-ssa-dom.c (cprop_operand): Don't replace loop invaeriant
+       copies with loop variant ones.
+
 2005-01-22  Kazu Hirata  <kazu@cs.umass.edu>
 
        * cfganal.c, real.h, reorg.c, timevar.def, tree-ssa-ccp.c,
index 35847ec..6814798 100644 (file)
@@ -2819,6 +2819,14 @@ cprop_operand (tree stmt, use_operand_p op_p)
         extensions.  */
       else if (!may_propagate_copy (op, val))
        return false;
+      
+      /* Do not propagate copies if the propagated value is at a deeper loop
+        depth than the propagatee.  Otherwise, this may move loop variant
+        variables outside of their loops and prevent coalescing
+        opportunities.  If the value was loop invariant, it will be hoisted
+        by LICM and exposed for copy propagation.  */
+      if (loop_depth_of_name (val) > loop_depth_of_name (op))
+       return false;
 
       /* Dump details.  */
       if (dump_file && (dump_flags & TDF_DETAILS))