* tree-scalar-evolution.c (scev_const_prop): Add arguments to
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 Jul 2007 23:04:06 +0000 (23:04 +0000)
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 Jul 2007 23:04:06 +0000 (23:04 +0000)
force_gimple_operand_bsi.
* tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr,
rewrite_use_compare): Ditto.
* tree-ssa-address.c (gimplify_mem_ref_parts, create_mem_ref):
Ditto.
* tree-ssa-ifcombine.c (ifcombine_ifandif): Ditto.
* tree-ssa-loop-prefetch.c (issue_prefetch_ref): Ditto.
* lambda-code.c (replace_uses_equiv_to_x_with_y): Ditto.
* tree-profile.c (prepare_instrumented_value,
tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_ic_profiler,
tree_gen_ic_func_profiler, tree_gen_average_profiler,
tree_gen_ior_profiler): Ditto.
* tree-ssa-reassoc.c (negate_value): Ditto.
* matrix-reorg.c (transform_access_sites, transform_allocation_sites):
Use force_gimple_operand_bsi.
* tree-vect-transform.c (vect_update_ivs_after_vectorizer): Ditto.
* tree-if-conv.c (add_to_dst_predicate_list,
find_phi_replacement_condition): Ditto.
* gimplify.c (force_gimple_operand_bsi): Add before and m arguments.
Call mark_symbols_for_renaming for new statements.
* tree-flow.h (force_gimple_operand_bsi): Declaration changed.

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

14 files changed:
gcc/ChangeLog
gcc/gimplify.c
gcc/lambda-code.c
gcc/matrix-reorg.c
gcc/tree-flow.h
gcc/tree-if-conv.c
gcc/tree-profile.c
gcc/tree-scalar-evolution.c
gcc/tree-ssa-address.c
gcc/tree-ssa-ifcombine.c
gcc/tree-ssa-loop-ivopts.c
gcc/tree-ssa-loop-prefetch.c
gcc/tree-ssa-reassoc.c
gcc/tree-vect-transform.c

index 2955ab8..db3a99c 100644 (file)
@@ -1,5 +1,31 @@
 2007-07-10  Zdenek Dvorak  <dvorakz@suse.cz>
 
+       * tree-scalar-evolution.c (scev_const_prop): Add arguments to
+       force_gimple_operand_bsi.
+       * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr,
+       rewrite_use_compare): Ditto.
+       * tree-ssa-address.c (gimplify_mem_ref_parts, create_mem_ref):
+       Ditto.
+       * tree-ssa-ifcombine.c (ifcombine_ifandif): Ditto.
+       * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Ditto.
+       * lambda-code.c (replace_uses_equiv_to_x_with_y): Ditto.
+       * tree-profile.c (prepare_instrumented_value,
+       tree_gen_interval_profiler, tree_gen_pow2_profiler,
+       tree_gen_one_value_profiler, tree_gen_ic_profiler,
+       tree_gen_ic_func_profiler, tree_gen_average_profiler,
+       tree_gen_ior_profiler): Ditto.
+       * tree-ssa-reassoc.c (negate_value): Ditto.
+       * matrix-reorg.c (transform_access_sites, transform_allocation_sites):
+       Use force_gimple_operand_bsi.
+       * tree-vect-transform.c (vect_update_ivs_after_vectorizer): Ditto.
+       * tree-if-conv.c (add_to_dst_predicate_list,
+       find_phi_replacement_condition): Ditto.
+       * gimplify.c (force_gimple_operand_bsi): Add before and m arguments.
+       Call mark_symbols_for_renaming for new statements.
+       * tree-flow.h (force_gimple_operand_bsi): Declaration changed.
+
+2007-07-10  Zdenek Dvorak  <dvorakz@suse.cz>
+
        * cfghooks.c (remove_edge): New function.
        (redirect_edge_and_branch, remove_branch, merge_blocks): Updated
        loop exit rescans.
index bc87f39..3b5fa89 100644 (file)
@@ -6648,17 +6648,34 @@ force_gimple_operand (tree expr, tree *stmts, bool simple, tree var)
 }
 
 /* Invokes force_gimple_operand for EXPR with parameters SIMPLE_P and VAR.  If
-   some statements are produced, emits them before BSI.  */
+   some statements are produced, emits them at BSI.  If BEFORE is true.
+   the statements are appended before BSI, otherwise they are appended after
+   it.  M specifies the way BSI moves after insertion (BSI_SAME_STMT or
+   BSI_CONTINUE_LINKING are the usual values).  */
 
 tree
 force_gimple_operand_bsi (block_stmt_iterator *bsi, tree expr,
-                         bool simple_p, tree var)
+                         bool simple_p, tree var, bool before,
+                         enum bsi_iterator_update m)
 {
   tree stmts;
 
   expr = force_gimple_operand (expr, &stmts, simple_p, var);
   if (stmts)
-    bsi_insert_before (bsi, stmts, BSI_SAME_STMT);
+    {
+      if (gimple_in_ssa_p (cfun))
+       {
+         tree_stmt_iterator tsi;
+
+         for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi))
+           mark_symbols_for_renaming (tsi_stmt (tsi));
+       }
+
+      if (before)
+       bsi_insert_before (bsi, stmts, m);
+      else
+       bsi_insert_after (bsi, stmts, m);
+    }
 
   return expr;
 }
index 91d82f7..40c6175 100644 (file)
@@ -2058,7 +2058,8 @@ replace_uses_equiv_to_x_with_y (struct loop *loop, tree stmt, tree x,
         which sets Y.  */
       var = create_tmp_var (TREE_TYPE (use), "perfecttmp");
       add_referenced_var (var);
-      val = force_gimple_operand_bsi (firstbsi, val, false, NULL);
+      val = force_gimple_operand_bsi (firstbsi, val, false, NULL,
+                                     true, BSI_SAME_STMT);
       setstmt = build_gimple_modify_stmt (var, val);
       var = make_ssa_name (var, setstmt);
       GIMPLE_STMT_OPERAND (setstmt, 0) = var;
index 1890734..5b54fe0 100644 (file)
@@ -1708,7 +1708,6 @@ compute_offset (HOST_WIDE_INT orig, HOST_WIDE_INT new, tree result)
 static int
 transform_access_sites (void **slot, void *data ATTRIBUTE_UNUSED)
 {
-  tree stmts;
   block_stmt_iterator bsi;
   struct matrix_info *mi = *slot;
   int min_escape_l = mi->min_indirect_level_escape;
@@ -1831,19 +1830,10 @@ transform_access_sites (void **slot, void *data ATTRIBUTE_UNUSED)
                  total_elements = new_offset;
                  if (new_offset != offset)
                    {
-                     tmp1 =
-                       force_gimple_operand (total_elements, &stmts, true,
-                                             NULL);
-                     if (stmts)
-                       {
-                         tree_stmt_iterator tsi;
-
-                         for (tsi = tsi_start (stmts); !tsi_end_p (tsi);
-                              tsi_next (&tsi))
-                           mark_symbols_for_renaming (tsi_stmt (tsi));
-                         bsi = bsi_for_stmt (acc_info->stmt);
-                         bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
-                       }
+                     bsi = bsi_for_stmt (acc_info->stmt);
+                     tmp1 = force_gimple_operand_bsi (&bsi, total_elements,
+                                                      true, NULL,
+                                                      true, BSI_SAME_STMT);
                    }
                  else
                    tmp1 = offset;
@@ -1855,18 +1845,10 @@ transform_access_sites (void **slot, void *data ATTRIBUTE_UNUSED)
              num_elements =
                fold_build2 (MULT_EXPR, sizetype, fold_convert (sizetype, acc_info->index),
                            fold_convert (sizetype, d_size));
-             tmp1 = force_gimple_operand (num_elements, &stmts, true, NULL);
              add_referenced_var (d_size);
-             if (stmts)
-               {
-                 tree_stmt_iterator tsi;
-
-                 for (tsi = tsi_start (stmts); !tsi_end_p (tsi);
-                      tsi_next (&tsi))
-                   mark_symbols_for_renaming (tsi_stmt (tsi));
-                 bsi = bsi_for_stmt (acc_info->stmt);
-                 bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
-               }
+             bsi = bsi_for_stmt (acc_info->stmt);
+             tmp1 = force_gimple_operand_bsi (&bsi, num_elements, true,
+                                              NULL, true, BSI_SAME_STMT);
            }
          /* Replace the offset if needed.  */
          if (tmp1 != offset)
@@ -1942,7 +1924,7 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED)
 {
   int i;
   struct matrix_info *mi;
-  tree type, call_stmt_0, malloc_stmt, oldfn, stmts, prev_dim_size, use_stmt;
+  tree type, call_stmt_0, malloc_stmt, oldfn, prev_dim_size, use_stmt;
   struct cgraph_node *c_node;
   struct cgraph_edge *e;
   block_stmt_iterator bsi;
@@ -2069,7 +2051,6 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED)
     {
       tree dim_size, dim_var, tmp;
       tree d_type_size;
-      tree_stmt_iterator tsi;
 
       /* Now put the size expression in a global variable and initialize it to
          the size expression before the malloc of level 0.  */
@@ -2099,20 +2080,13 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED)
 
          dim_size = fold_build2 (MULT_EXPR, type, dim_size, prev_dim_size);
        }
-      dim_size = force_gimple_operand (dim_size, &stmts, true, NULL);
-      if (stmts)
-       {
-         for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi))
-           mark_symbols_for_renaming (tsi_stmt (tsi));
-         bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
-         bsi = bsi_for_stmt (call_stmt_0);
-       }
+      dim_size = force_gimple_operand_bsi (&bsi, dim_size, true, NULL,
+                                          true, BSI_SAME_STMT);
       /* GLOBAL_HOLDING_THE_SIZE = DIM_SIZE.  */
       tmp = fold_build2 (GIMPLE_MODIFY_STMT, type, dim_var, dim_size);
       GIMPLE_STMT_OPERAND (tmp, 0) = dim_var;
       mark_symbols_for_renaming (tmp);
-      bsi_insert_before (&bsi, tmp, BSI_NEW_STMT);
-      bsi = bsi_for_stmt (call_stmt_0);
+      bsi_insert_before (&bsi, tmp, BSI_SAME_STMT);
 
       prev_dim_size = mi->dimension_size[i] = dim_var;
     }
@@ -2122,17 +2096,8 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED)
   malloc_stmt = GIMPLE_STMT_OPERAND (call_stmt_0, 1);
   c_node = cgraph_node (mi->allocation_function_decl);
   old_size_0 = CALL_EXPR_ARG (malloc_stmt, 0);
-  bsi = bsi_for_stmt (call_stmt_0);
-  tmp = force_gimple_operand (mi->dimension_size[0], &stmts, true, NULL);
-  if (stmts)
-    {
-      tree_stmt_iterator tsi;
-
-      for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi))
-       mark_symbols_for_renaming (tsi_stmt (tsi));
-      bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
-      bsi = bsi_for_stmt (call_stmt_0);
-    }
+  tmp = force_gimple_operand_bsi (&bsi, mi->dimension_size[0], true,
+                                 NULL, true, BSI_SAME_STMT);
   if (TREE_CODE (old_size_0) == SSA_NAME)
     {
       FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, old_size_0)
index 542f5f8..51a03ba 100644 (file)
@@ -1126,7 +1126,8 @@ extern void register_jump_thread (edge, edge);
 
 /* In gimplify.c  */
 tree force_gimple_operand (tree, tree *, bool, tree);
-tree force_gimple_operand_bsi (block_stmt_iterator *, tree, bool, tree);
+tree force_gimple_operand_bsi (block_stmt_iterator *, tree, bool, tree,
+                              bool, enum bsi_iterator_update);
 
 /* In tree-ssa-structalias.c */
 bool find_what_p_points_to (tree);
index 4714bd7..b18de42 100644 (file)
@@ -637,17 +637,12 @@ add_to_dst_predicate_list (struct loop * loop, edge e,
     {
       tree tmp;
       tree tmp_stmt = NULL_TREE;
-      tree tmp_stmts1 = NULL_TREE;
-      tree tmp_stmts2 = NULL_TREE;
-      prev_cond = force_gimple_operand (unshare_expr (prev_cond),
-                                       &tmp_stmts1, true, NULL);
-      if (tmp_stmts1)
-        bsi_insert_before (bsi, tmp_stmts1, BSI_SAME_STMT);
-
-      cond = force_gimple_operand (unshare_expr (cond),
-                                  &tmp_stmts2, true, NULL);
-      if (tmp_stmts2)
-        bsi_insert_before (bsi, tmp_stmts2, BSI_SAME_STMT);
+
+      prev_cond = force_gimple_operand_bsi (bsi, unshare_expr (prev_cond),
+                                           true, NULL, true, BSI_SAME_STMT);
+
+      cond = force_gimple_operand_bsi (bsi, unshare_expr (cond),
+                                      true, NULL, true, BSI_SAME_STMT);
 
       /* Add the condition to aux field of the edge.  In case edge
         destination is a PHI node, this condition will be ANDed with
@@ -698,7 +693,7 @@ find_phi_replacement_condition (struct loop *loop,
                                 block_stmt_iterator *bsi)
 {
   edge first_edge, second_edge;
-  tree tmp_cond, new_stmts;
+  tree tmp_cond;
 
   gcc_assert (EDGE_COUNT (bb->preds) == 2);
   first_edge = EDGE_PRED (bb, 0);
@@ -777,9 +772,8 @@ find_phi_replacement_condition (struct loop *loop,
      value as condition. Various targets use different means to communicate
      condition in vector compare operation. Using gimple value allows compiler
      to emit vector compare and select RTL without exposing compare's result.  */
-  *cond = force_gimple_operand (*cond, &new_stmts, false, NULL_TREE);
-  if (new_stmts)
-    bsi_insert_before (bsi, new_stmts, BSI_SAME_STMT);
+  *cond = force_gimple_operand_bsi (bsi, *cond, false, NULL_TREE,
+                                   true, BSI_SAME_STMT);
   if (!is_gimple_reg (*cond) && !is_gimple_condexpr (*cond))
     {
       tree new_stmt;
index 2dace9c..ee2748b 100644 (file)
@@ -192,7 +192,7 @@ prepare_instrumented_value (block_stmt_iterator *bsi,
 {
   tree val = value->hvalue.value;
   return force_gimple_operand_bsi (bsi, fold_convert (gcov_type_node, val),
-                                  true, NULL_TREE);
+                                  true, NULL_TREE, true, BSI_SAME_STMT);
 }
 
 /* Output instructions as GIMPLE trees to increment the interval histogram 
@@ -211,7 +211,7 @@ tree_gen_interval_profiler (histogram_value value, unsigned tag, unsigned base)
   
   ref_ptr = force_gimple_operand_bsi (&bsi,
                                      build_addr (ref, current_function_decl),
-                                     true, NULL_TREE);
+                                     true, NULL_TREE, true, BSI_SAME_STMT);
   val = prepare_instrumented_value (&bsi, value);
   call = build_call_expr (tree_interval_profiler_fn, 4,
                          ref_ptr, val, start, steps);
@@ -232,7 +232,7 @@ tree_gen_pow2_profiler (histogram_value value, unsigned tag, unsigned base)
   
   ref_ptr = force_gimple_operand_bsi (&bsi,
                                      build_addr (ref, current_function_decl),
-                                     true, NULL_TREE);
+                                     true, NULL_TREE, true, BSI_SAME_STMT);
   val = prepare_instrumented_value (&bsi, value);
   call = build_call_expr (tree_pow2_profiler_fn, 2, ref_ptr, val);
   bsi_insert_before (&bsi, call, BSI_SAME_STMT);
@@ -252,7 +252,7 @@ tree_gen_one_value_profiler (histogram_value value, unsigned tag, unsigned base)
   
   ref_ptr = force_gimple_operand_bsi (&bsi,
                                      build_addr (ref, current_function_decl),
-                                     true, NULL_TREE);
+                                     true, NULL_TREE, true, BSI_SAME_STMT);
   val = prepare_instrumented_value (&bsi, value);
   call = build_call_expr (tree_one_value_profiler_fn, 2, ref_ptr, val);
   bsi_insert_before (&bsi, call, BSI_SAME_STMT);
@@ -275,7 +275,7 @@ tree_gen_ic_profiler (histogram_value value, unsigned tag, unsigned base)
 
   ref_ptr = force_gimple_operand_bsi (&bsi,
                                      build_addr (ref, current_function_decl),
-                                     true, NULL_TREE);
+                                     true, NULL_TREE, true, BSI_SAME_STMT);
 
   /* Insert code:
     
@@ -325,7 +325,8 @@ tree_gen_ic_func_profiler (void)
       cur_func = force_gimple_operand_bsi (&bsi,
                                           build_addr (current_function_decl, 
                                                       current_function_decl),
-                                          true, NULL_TREE);
+                                          true, NULL_TREE,
+                                          true, BSI_SAME_STMT);
       tree_uid = build_int_cst (gcov_type_node, c_node->pid);
       stmt1 = build_call_expr (tree_indirect_call_profiler_fn, 4,
                               ic_gcov_type_ptr_var,
@@ -367,7 +368,8 @@ tree_gen_average_profiler (histogram_value value, unsigned tag, unsigned base)
   
   ref_ptr = force_gimple_operand_bsi (&bsi,
                                      build_addr (ref, current_function_decl),
-                                     true, NULL_TREE);
+                                     true, NULL_TREE,
+                                     true, BSI_SAME_STMT);
   val = prepare_instrumented_value (&bsi, value);
   call = build_call_expr (tree_average_profiler_fn, 2, ref_ptr, val);
   bsi_insert_before (&bsi, call, BSI_SAME_STMT);
@@ -387,7 +389,7 @@ tree_gen_ior_profiler (histogram_value value, unsigned tag, unsigned base)
   
   ref_ptr = force_gimple_operand_bsi (&bsi,
                                      build_addr (ref, current_function_decl),
-                                     true, NULL_TREE);
+                                     true, NULL_TREE, true, BSI_SAME_STMT);
   val = prepare_instrumented_value (&bsi, value);
   call = build_call_expr (tree_ior_profiler_fn, 2, ref_ptr, val);
   bsi_insert_before (&bsi, call, BSI_SAME_STMT);
index 6dc69f2..f9d08f3 100644 (file)
@@ -2851,7 +2851,8 @@ scev_const_prop (void)
          {
            block_stmt_iterator dest = bsi;
            bsi_insert_before (&dest, ass, BSI_NEW_STMT);
-           def = force_gimple_operand_bsi (&dest, def, false, NULL_TREE);
+           def = force_gimple_operand_bsi (&dest, def, false, NULL_TREE,
+                                           true, BSI_SAME_STMT);
          }
          GIMPLE_STMT_OPERAND (ass, 1) = def;
          update_stmt (ass);
index cbd9355..7904b1a 100644 (file)
@@ -556,10 +556,12 @@ gimplify_mem_ref_parts (block_stmt_iterator *bsi, struct mem_address *parts)
 {
   if (parts->base)
     parts->base = force_gimple_operand_bsi (bsi, parts->base,
-                                           true, NULL_TREE);
+                                           true, NULL_TREE,
+                                           true, BSI_SAME_STMT);
   if (parts->index)
     parts->index = force_gimple_operand_bsi (bsi, parts->index,
-                                            true, NULL_TREE);
+                                            true, NULL_TREE,
+                                            true, BSI_SAME_STMT);
 }
 
 /* Creates and returns a TARGET_MEM_REF for address ADDR.  If necessary
@@ -588,7 +590,7 @@ create_mem_ref (block_stmt_iterator *bsi, tree type, aff_tree *addr)
       parts.index = force_gimple_operand_bsi (bsi,
                                fold_build2 (MULT_EXPR, sizetype,
                                             parts.index, parts.step),
-                               true, NULL_TREE);
+                               true, NULL_TREE, true, BSI_SAME_STMT);
       parts.step = NULL_TREE;
   
       mem_ref = create_mem_ref_raw (type, &parts);
@@ -614,7 +616,7 @@ create_mem_ref (block_stmt_iterator *bsi, tree type, aff_tree *addr)
                        fold_build2 (PLUS_EXPR, atype,
                                     fold_convert (atype, parts.base),
                                     tmp),
-                       true, NULL_TREE);
+                       true, NULL_TREE, true, BSI_SAME_STMT);
            }
          else
            {
@@ -641,7 +643,7 @@ create_mem_ref (block_stmt_iterator *bsi, tree type, aff_tree *addr)
                        fold_build2 (PLUS_EXPR, atype,
                                     parts.base,
                                     fold_convert (atype, parts.index)),
-                       true, NULL_TREE);
+                       true, NULL_TREE, true, BSI_SAME_STMT);
        }
       else
        parts.base = parts.index;
@@ -662,7 +664,7 @@ create_mem_ref (block_stmt_iterator *bsi, tree type, aff_tree *addr)
                        fold_build2 (POINTER_PLUS_EXPR, atype,
                                     parts.base,
                                     fold_convert (sizetype, parts.offset)),
-                       true, NULL_TREE);
+                       true, NULL_TREE, true, BSI_SAME_STMT);
        }
       else
        parts.base = parts.offset;
index 9403857..9486e54 100644 (file)
@@ -317,9 +317,11 @@ ifcombine_ifandif (basic_block inner_cond_bb, basic_block outer_cond_bb)
       t2 = fold_build2 (LSHIFT_EXPR, TREE_TYPE (name1),
                        integer_one_node, bit2);
       t = fold_build2 (BIT_IOR_EXPR, TREE_TYPE (name1), t, t2);
-      t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE);
+      t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE,
+                                   true, BSI_SAME_STMT);
       t2 = fold_build2 (BIT_AND_EXPR, TREE_TYPE (name1), name1, t);
-      t2 = force_gimple_operand_bsi (&bsi, t2, true, NULL_TREE);
+      t2 = force_gimple_operand_bsi (&bsi, t2, true, NULL_TREE,
+                                    true, BSI_SAME_STMT);
       COND_EXPR_COND (inner_cond) = fold_build2 (EQ_EXPR, boolean_type_node,
                                                 t2, t);
       update_stmt (inner_cond);
@@ -405,9 +407,11 @@ ifcombine_iforif (basic_block inner_cond_bb, basic_block outer_cond_bb)
       /* Do it.  */
       bsi = bsi_for_stmt (inner_cond);
       t = fold_build2 (BIT_IOR_EXPR, TREE_TYPE (name1), bits1, bits2);
-      t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE);
+      t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE,
+                                   true, BSI_SAME_STMT);
       t = fold_build2 (BIT_AND_EXPR, TREE_TYPE (name1), name1, t);
-      t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE);
+      t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE,
+                                   true, BSI_SAME_STMT);
       COND_EXPR_COND (inner_cond) = fold_build2 (NE_EXPR, boolean_type_node, t,
                                                 build_int_cst (TREE_TYPE (t), 0));
       update_stmt (inner_cond);
index f99a6eb..c673100 100644 (file)
@@ -4862,7 +4862,7 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data,
                            struct iv_use *use, struct iv_cand *cand)
 {
   tree comp;
-  tree op, stmts, tgt, ass;
+  tree op, tgt, ass;
   block_stmt_iterator bsi;
 
   /* An important special case -- if we are asked to express value of
@@ -4947,9 +4947,8 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data,
       gcc_unreachable ();
     }
 
-  op = force_gimple_operand (comp, &stmts, false, SSA_NAME_VAR (tgt));
-  if (stmts)
-    bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
+  op = force_gimple_operand_bsi (&bsi, comp, false, SSA_NAME_VAR (tgt),
+                                true, BSI_SAME_STMT);
 
   if (TREE_CODE (use->stmt) == PHI_NODE)
     {
@@ -5115,7 +5114,8 @@ rewrite_use_compare (struct ivopts_data *data,
 
       compare = iv_elimination_compare (data, use);
       bound = unshare_expr (fold_convert (var_type, bound));
-      op = force_gimple_operand_bsi (&bsi, bound, true, NULL_TREE);
+      op = force_gimple_operand_bsi (&bsi, bound, true, NULL_TREE,
+                                    true, BSI_SAME_STMT);
 
       *use->op_p = build2 (compare, boolean_type_node, var, op);
       return;
@@ -5129,7 +5129,8 @@ rewrite_use_compare (struct ivopts_data *data,
   ok = extract_cond_operands (data, use->op_p, &var_p, NULL, NULL, NULL);
   gcc_assert (ok);
 
-  *var_p = force_gimple_operand_bsi (&bsi, comp, true, SSA_NAME_VAR (*var_p));
+  *var_p = force_gimple_operand_bsi (&bsi, comp, true, SSA_NAME_VAR (*var_p),
+                                    true, BSI_SAME_STMT);
 }
 
 /* Rewrites USE using candidate CAND.  */
index 4c965d1..2105299 100644 (file)
@@ -883,7 +883,8 @@ issue_prefetch_ref (struct mem_ref *ref, unsigned unroll_factor, unsigned ahead)
   n_prefetches = ((unroll_factor + ref->prefetch_mod - 1)
                  / ref->prefetch_mod);
   addr_base = build_fold_addr_expr_with_type (ref->mem, ptr_type_node);
-  addr_base = force_gimple_operand_bsi (&bsi, unshare_expr (addr_base), true, NULL);
+  addr_base = force_gimple_operand_bsi (&bsi, unshare_expr (addr_base),
+                                       true, NULL, true, BSI_SAME_STMT);
   write_p = ref->write_p ? integer_one_node : integer_zero_node;
   local = build_int_cst (integer_type_node, nontemporal ? 0 : 3);
 
@@ -893,7 +894,8 @@ issue_prefetch_ref (struct mem_ref *ref, unsigned unroll_factor, unsigned ahead)
       delta = (ahead + ap * ref->prefetch_mod) * ref->group->step;
       addr = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node,
                          addr_base, size_int (delta));
-      addr = force_gimple_operand_bsi (&bsi, unshare_expr (addr), true, NULL);
+      addr = force_gimple_operand_bsi (&bsi, unshare_expr (addr), true, NULL,
+                                      true, BSI_SAME_STMT);
 
       /* Create the prefetch instruction.  */
       prefetch = build_call_expr (built_in_decls[BUILT_IN_PREFETCH],
index a38290b..cc974f1 100644 (file)
@@ -1026,7 +1026,7 @@ negate_value (tree tonegate, block_stmt_iterator *bsi)
 
   tonegate = fold_build1 (NEGATE_EXPR, TREE_TYPE (tonegate), tonegate);
   resultofnegate = force_gimple_operand_bsi (bsi, tonegate, true,
-                                            NULL_TREE);
+                                            NULL_TREE, true, BSI_SAME_STMT);
   VEC_safe_push (tree, heap, broken_up_subtracts, resultofnegate);
   return resultofnegate;
 
index cecf1a0..8a6e086 100644 (file)
@@ -5341,7 +5341,7 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters,
       tree evolution_part;
       tree init_expr;
       tree step_expr;
-      tree var, stmt, ni, ni_name;
+      tree var, ni, ni_name;
       block_stmt_iterator last_bsi;
 
       if (vect_print_dump_info (REPORT_DETAILS))
@@ -5399,13 +5399,10 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters,
       var = create_tmp_var (TREE_TYPE (init_expr), "tmp");
       add_referenced_var (var);
 
-      ni_name = force_gimple_operand (ni, &stmt, false, var);
-      
-      /* Insert stmt into exit_bb.  */
       last_bsi = bsi_last (exit_bb);
-      if (stmt)
-        bsi_insert_before (&last_bsi, stmt, BSI_SAME_STMT);   
-
+      ni_name = force_gimple_operand_bsi (&last_bsi, ni, false, var,
+                                         true, BSI_SAME_STMT);
+      
       /* Fix phi expressions in the successor bb.  */
       SET_PHI_ARG_DEF (phi1, update_e->dest_idx, ni_name);
     }