OSDN Git Service

* tree-scalar-evolution.c (instantiate_parameters_1): An SSA_NAME
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Mar 2008 11:51:36 +0000 (11:51 +0000)
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Mar 2008 11:51:36 +0000 (11:51 +0000)
defined in a loop at depth 0 is invariant.
* tree-chrec.c (evolution_function_is_invariant_rec_p): Ditto.
* tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Should never
be called at loop depth 0.

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

gcc/ChangeLog
gcc/tree-chrec.c
gcc/tree-scalar-evolution.c
gcc/tree-ssa-loop-ivopts.c

index 3874129..6565763 100644 (file)
@@ -1,3 +1,11 @@
+2008-03-02  Sebastian Pop  <sebastian.pop@amd.com>
+
+       * tree-scalar-evolution.c (instantiate_parameters_1): An SSA_NAME
+       defined in a loop at depth 0 is invariant.
+       * tree-chrec.c (evolution_function_is_invariant_rec_p): Ditto.
+       * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Should never
+       be called at loop depth 0.
+
 2008-03-02  Jakub Jelinek  <jakub@redhat.com>
 
        PR driver/35420
index 37b7c0d..295fb79 100644 (file)
@@ -948,8 +948,9 @@ evolution_function_is_invariant_rec_p (tree chrec, int loopnum)
   if (evolution_function_is_constant_p (chrec))
     return true;
 
-  if (TREE_CODE (chrec) == SSA_NAME 
-      && expr_invariant_in_loop_p (get_loop (loopnum), chrec))
+  if (TREE_CODE (chrec) == SSA_NAME
+      && (loopnum == 0
+         || expr_invariant_in_loop_p (get_loop (loopnum), chrec)))
     return true;
 
   if (TREE_CODE (chrec) == POLYNOMIAL_CHREC)
index ad8f2f0..4d771b7 100644 (file)
@@ -1971,6 +1971,7 @@ instantiate_parameters_1 (struct loop *loop, tree chrec, int flags, htab_t cache
       /* A parameter (or loop invariant and we do not want to include
         evolutions in outer loops), nothing to do.  */
       if (!def_bb
+         || loop_depth (def_bb->loop_father) == 0
          || (!(flags & INSERT_SUPERLOOP_CHRECS)
              && !flow_bb_inside_loop_p (loop, def_bb)))
        return chrec;
index 7bcb981..4121d82 100644 (file)
@@ -1254,7 +1254,8 @@ find_interesting_uses_cond (struct ivopts_data *data, tree stmt, tree *cond_p)
 }
 
 /* Returns true if expression EXPR is obviously invariant in LOOP,
-   i.e. if all its operands are defined outside of the LOOP.  */
+   i.e. if all its operands are defined outside of the LOOP.  LOOP
+   should not be the function body.  */
 
 bool
 expr_invariant_in_loop_p (struct loop *loop, tree expr)
@@ -1262,6 +1263,8 @@ expr_invariant_in_loop_p (struct loop *loop, tree expr)
   basic_block def_bb;
   unsigned i, len;
 
+  gcc_assert (loop_depth (loop) > 0);
+
   if (is_gimple_min_invariant (expr))
     return true;