OSDN Git Service

Move ChangeLog entry to correct ChangeLog file.
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa-sink.c
index 40d3a29..bfa1a31 100644 (file)
@@ -25,7 +25,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "tm.h"
 #include "tree.h"
 #include "basic-block.h"
-#include "diagnostic.h"
 #include "gimple-pretty-print.h"
 #include "tree-inline.h"
 #include "tree-flow.h"
@@ -191,8 +190,12 @@ is_hidden_global_store (gimple stmt)
            return true;
 
        }
-      else if (INDIRECT_REF_P (lhs))
+      else if (INDIRECT_REF_P (lhs)
+              || TREE_CODE (lhs) == MEM_REF
+              || TREE_CODE (lhs) == TARGET_MEM_REF)
        return ptr_deref_may_alias_global_p (TREE_OPERAND (lhs, 0));
+      else if (CONSTANT_CLASS_P (lhs))
+       return true;
       else
        gcc_unreachable ();
     }
@@ -426,6 +429,12 @@ statement_sink_location (gimple stmt, basic_block frombb,
       || sinkbb->loop_father != frombb->loop_father)
     return false;
 
+  /* If the latch block is empty, don't make it non-empty by sinking
+     something into it.  */
+  if (sinkbb == frombb->loop_father->latch
+      && empty_block_p (sinkbb))
+    return false;
+
   /* Move the expression to a post dominator can't reduce the number of
      executions.  */
   if (dominated_by_p (CDI_POST_DOMINATORS, frombb, sinkbb))