OSDN Git Service

2006-02-02 Paolo Bonzini <bonzini@gnu.org>
authorbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Feb 2006 13:05:36 +0000 (13:05 +0000)
committerbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Feb 2006 13:05:36 +0000 (13:05 +0000)
* tree-flow-inline.h (bsi_after_labels): Rewrite, return
what its name says.
* lambda-code.c (perfect_nestify): Use bsi_insert_before on
bsi_after_labels iterator.
* tree-if-conv.c (find_phi_replacement_condition,
replace_phi_with_cond_modify_expr): Likewise.
* tree-scalar-evolution.c (scev_const_prop): Likewise.
* tree-ssa-loop-ivopts.c (compute_phi_arg_on_exit): Likewise.

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

gcc/ChangeLog
gcc/lambda-code.c
gcc/tree-flow-inline.h
gcc/tree-if-conv.c
gcc/tree-scalar-evolution.c
gcc/tree-ssa-loop-ivopts.c

index 7c6288e..078ea9d 100644 (file)
@@ -1,3 +1,14 @@
+2006-02-02  Paolo Bonzini  <bonzini@gnu.org>
+
+       * tree-flow-inline.h (bsi_after_labels): Rewrite, return
+       what its name says.
+       * lambda-code.c (perfect_nestify): Use bsi_insert_before on
+       bsi_after_labels iterator.
+       * tree-if-conv.c (find_phi_replacement_condition,
+       replace_phi_with_cond_modify_expr): Likewise.
+       * tree-scalar-evolution.c (scev_const_prop): Likewise.
+       * tree-ssa-loop-ivopts.c (compute_phi_arg_on_exit): Likewise.
+
 2006-02-02  Diego Novillo  <dnovillo@redhat.com>
 
        * tree-inline.c (copy_tree_r): Also copy OMP_CLAUSE nodes.
index c19ea6c..ee1d169 100644 (file)
@@ -2556,7 +2556,7 @@ perfect_nestify (struct loops *loops,
                          newname = make_ssa_name (newname, newstmt);
                          TREE_OPERAND (newstmt, 0) = newname;
                          SET_USE (use_p, TREE_OPERAND (newstmt, 0));
-                         bsi_insert_after (&tobsi, newstmt, BSI_SAME_STMT);
+                         bsi_insert_before (&tobsi, newstmt, BSI_SAME_STMT);
                          update_stmt (newstmt);
                          update_stmt (imm_stmt);
                        } 
index 69bef68..0ae99b9 100644 (file)
@@ -734,37 +734,15 @@ bsi_start (basic_block bb)
 }
 
 /* Return a block statement iterator that points to the first non-label
-   block BB.  */
+   statement in block BB.  */
 
 static inline block_stmt_iterator
 bsi_after_labels (basic_block bb)
 {
-  block_stmt_iterator bsi;
-  tree_stmt_iterator next;
-
-  bsi.bb = bb;
-
-  if (!bb->stmt_list)
-    {
-      gcc_assert (bb->index < NUM_FIXED_BLOCKS);
-      bsi.tsi.ptr = NULL;
-      bsi.tsi.container = NULL;
-      return bsi;
-    }
-
-  bsi.tsi = tsi_start (bb->stmt_list);
-  if (tsi_end_p (bsi.tsi))
-    return bsi;
+  block_stmt_iterator bsi = bsi_start (bb);
 
-  next = bsi.tsi;
-  tsi_next (&next);
-
-  while (!tsi_end_p (next)
-        && TREE_CODE (tsi_stmt (next)) == LABEL_EXPR)
-    {
-      bsi.tsi = next;
-      tsi_next (&next);
-    }
+  while (!bsi_end_p (bsi) && TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR)
+    bsi_next (&bsi);
 
   return bsi;
 }
index 8c41e94..97deb28 100644 (file)
@@ -737,8 +737,7 @@ find_phi_replacement_condition (struct loop *loop,
       tree new_stmt;
 
       new_stmt = ifc_temp_var (TREE_TYPE (*cond), unshare_expr (*cond));
-      bsi_insert_after (bsi, new_stmt, BSI_SAME_STMT);
-      bsi_next (bsi);
+      bsi_insert_before (bsi, new_stmt, BSI_SAME_STMT);
       *cond = TREE_OPERAND (new_stmt, 0);
     }
 
@@ -804,9 +803,7 @@ replace_phi_with_cond_modify_expr (tree phi, tree cond, basic_block true_bb,
   SSA_NAME_DEF_STMT (PHI_RESULT (phi)) = new_stmt;
 
   /* Insert using iterator.  */
-  bsi_insert_after (bsi, new_stmt, BSI_SAME_STMT);
-  bsi_next (bsi);
-
+  bsi_insert_before (bsi, new_stmt, BSI_SAME_STMT);
   update_stmt (new_stmt);
 
   if (dump_file && (dump_flags & TDF_DETAILS))
index 3075839..462d78f 100644 (file)
@@ -2793,8 +2793,11 @@ scev_const_prop (void)
 
          ass = build2 (MODIFY_EXPR, void_type_node, rslt, NULL_TREE);
          SSA_NAME_DEF_STMT (rslt) = ass;
-         bsi_insert_after (&bsi, ass, BSI_NEW_STMT);
-         def = force_gimple_operand_bsi (&bsi, def, false, NULL_TREE);
+         {
+           block_stmt_iterator dest = bsi;
+           bsi_insert_before (&dest, ass, BSI_NEW_STMT);
+           def = force_gimple_operand_bsi (&dest, def, false, NULL_TREE);
+         }
          TREE_OPERAND (ass, 1) = def;
          update_stmt (ass);
        }
index 7e1363e..4925d45 100644 (file)
@@ -5695,14 +5695,15 @@ compute_phi_arg_on_exit (edge exit, tree stmts, tree op)
     {
       for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi))
         {
-         bsi_insert_after (&bsi, tsi_stmt (tsi), BSI_NEW_STMT);
-         protect_loop_closed_ssa_form (exit, bsi_stmt (bsi));
+         tree stmt = tsi_stmt (tsi);
+         bsi_insert_before (&bsi, stmt, BSI_SAME_STMT);
+         protect_loop_closed_ssa_form (exit, stmt);
        }
     }
   else
     {
-      bsi_insert_after (&bsi, stmts, BSI_NEW_STMT);
-      protect_loop_closed_ssa_form (exit, bsi_stmt (bsi));
+      bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
+      protect_loop_closed_ssa_form (exit, stmts);
     }
 
   if (!op)
@@ -5719,7 +5720,7 @@ compute_phi_arg_on_exit (edge exit, tree stmts, tree op)
          stmt = build2 (MODIFY_EXPR, TREE_TYPE (op),
                        def, op);
          SSA_NAME_DEF_STMT (def) = stmt;
-         bsi_insert_after (&bsi, stmt, BSI_CONTINUE_LINKING);
+         bsi_insert_before (&bsi, stmt, BSI_SAME_STMT);
        }
     }
 }