Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 346445 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-50 / +7 lines)
Line  Link Here
0
-- a/gcc/graphite-sese-to-poly.c
0
++ b/gcc/graphite-sese-to-poly.c
Lines 2231-2288 rewrite_phi_out_of_ssa (gimple_stmt_iterator *psi) Link Here
2231
  for (i = 0; i < gimple_phi_num_args (phi); i++)
2231
  for (i = 0; i < gimple_phi_num_args (phi); i++)
2232
    {
2232
    {
2233
      tree arg = gimple_phi_arg_def (phi, i);
2233
      tree arg = gimple_phi_arg_def (phi, i);
2234
      edge e = gimple_phi_arg_edge (phi, i);
2234
2235
2235
      /* Try to avoid the insertion on edges as much as possible: this
2236
      /* Avoid the insertion of code in the loop latch to please the
2236
	 would avoid the insertion of code on loop latch edges, making
2237
	 pattern matching of the vectorizer.  */
2237
	 the pattern matching of the vectorizer happy, or it would
2238
	 avoid the insertion of useless basic blocks.  Note that it is
2239
	 incorrect to insert out of SSA copies close by their
2240
	 definition when they are more than two loop levels apart:
2241
	 for example, starting from a double nested loop
2242
2243
	 | a = ...
2244
	 | loop_1
2245
	 |  loop_2
2246
	 |    b = phi (a, c)
2247
	 |    c = ...
2248
	 |  end_2
2249
	 | end_1
2250
2251
	 the following transform is incorrect
2252
2253
	 | a = ...
2254
	 | Red[0] = a
2255
	 | loop_1
2256
	 |  loop_2
2257
	 |    b = Red[0]
2258
	 |    c = ...
2259
	 |    Red[0] = c
2260
	 |  end_2
2261
	 | end_1
2262
2263
	 whereas inserting the copy on the incoming edge is correct
2264
2265
	 | a = ...
2266
	 | loop_1
2267
	 |  Red[0] = a
2268
	 |  loop_2
2269
	 |    b = Red[0]
2270
	 |    c = ...
2271
	 |    Red[0] = c
2272
	 |  end_2
2273
	 | end_1
2274
      */
2275
      if (TREE_CODE (arg) == SSA_NAME
2238
      if (TREE_CODE (arg) == SSA_NAME
2276
	  && is_gimple_reg (arg)
2239
	  && e->src == bb->loop_father->latch)
2277
	  && gimple_bb (SSA_NAME_DEF_STMT (arg))
2240
 	insert_out_of_ssa_copy (zero_dim_array, arg);
2278
	  && (flow_bb_inside_loop_p (bb->loop_father,
2279
				     gimple_bb (SSA_NAME_DEF_STMT (arg)))
2280
	      || flow_bb_inside_loop_p (loop_outer (bb->loop_father),
2281
					gimple_bb (SSA_NAME_DEF_STMT (arg)))))
2282
	insert_out_of_ssa_copy (zero_dim_array, arg);
2283
      else
2241
      else
2284
	insert_out_of_ssa_copy_on_edge (gimple_phi_arg_edge (phi, i),
2242
	insert_out_of_ssa_copy_on_edge (e, zero_dim_array, arg);
2285
					zero_dim_array, arg);
2286
    }
2243
    }
2287
2244
2288
  var = force_gimple_operand (zero_dim_array, &stmts, true, NULL_TREE);
2245
  var = force_gimple_operand (zero_dim_array, &stmts, true, NULL_TREE);

Return to bug 346445