X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fgraphite.c;h=e106f480cbce9bea60c25918d5e702f68e5db949;hb=8f24e4bd10cb440d4d00c29b2294fadf969126a5;hp=13b9ad6f3c4b6f2522678cf50f411cb96e495265;hpb=a72d4b7d9e952ea932e54819b5574160c0a828d4;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/graphite.c b/gcc/graphite.c index 13b9ad6f3c4..e106f480cbc 100644 --- a/gcc/graphite.c +++ b/gcc/graphite.c @@ -1058,31 +1058,24 @@ loop_affine_expr (basic_block scop_entry, struct loop *loop, tree expr) || evolution_function_is_affine_multivariate_p (scev, n)); } -/* Return false if the tree_code of the operand OP or any of its operands - is component_ref. */ +/* Return true if REF or any of its subtrees contains a + component_ref. */ static bool -exclude_component_ref (tree op) +contains_component_ref_p (tree ref) { - int i; - int len; + if (!ref) + return false; - if (op) + while (handled_component_p (ref)) { - if (TREE_CODE (op) == COMPONENT_REF) - return false; - else - { - len = TREE_OPERAND_LENGTH (op); - for (i = 0; i < len; ++i) - { - if (!exclude_component_ref (TREE_OPERAND (op, i))) - return false; - } - } + if (TREE_CODE (ref) == COMPONENT_REF) + return true; + + ref = TREE_OPERAND (ref, 0); } - return true; + return false; } /* Return true if the operand OP is simple. */ @@ -1094,13 +1087,15 @@ is_simple_operand (loop_p loop, gimple stmt, tree op) if (DECL_P (op) /* or a structure, */ || AGGREGATE_TYPE_P (TREE_TYPE (op)) + /* or a COMPONENT_REF, */ + || contains_component_ref_p (op) /* or a memory access that cannot be analyzed by the data reference analysis. */ || ((handled_component_p (op) || INDIRECT_REF_P (op)) && !stmt_simple_memref_p (loop, stmt, op))) return false; - return exclude_component_ref (op); + return true; } /* Return true only when STMT is simple enough for being handled by @@ -1209,11 +1204,23 @@ static gimple harmful_stmt_in_bb (basic_block scop_entry, basic_block bb) { gimple_stmt_iterator gsi; + gimple stmt; for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) if (!stmt_simple_for_scop_p (scop_entry, gsi_stmt (gsi))) return gsi_stmt (gsi); + stmt = last_stmt (bb); + if (stmt && gimple_code (stmt) == GIMPLE_COND) + { + tree lhs = gimple_cond_lhs (stmt); + tree rhs = gimple_cond_rhs (stmt); + + if (TREE_CODE (TREE_TYPE (lhs)) == REAL_TYPE + || TREE_CODE (TREE_TYPE (rhs)) == REAL_TYPE) + return stmt; + } + return NULL; } @@ -2352,7 +2359,7 @@ nb_reductions_in_loop (loop_p loop) scev = analyze_scalar_evolution (loop, PHI_RESULT (phi)); scev = instantiate_parameters (loop, scev); - if (!simple_iv (loop, phi, PHI_RESULT (phi), &iv, true)) + if (!simple_iv (loop, loop, PHI_RESULT (phi), &iv, true)) res++; } @@ -2370,8 +2377,10 @@ graphite_loop_normal_form (loop_p loop) tree nit; gimple_seq stmts; edge exit = single_dom_exit (loop); + bool known_niter = number_of_iterations_exit (loop, exit, &niter, false); + + gcc_assert (known_niter); - gcc_assert (number_of_iterations_exit (loop, exit, &niter, false)); nit = force_gimple_operand (unshare_expr (niter.niter), &stmts, true, NULL_TREE); if (stmts) @@ -2381,7 +2390,7 @@ graphite_loop_normal_form (loop_p loop) if (nb_reductions_in_loop (loop) > 0) return NULL_TREE; - return canonicalize_loop_ivs (loop, NULL, nit); + return canonicalize_loop_ivs (loop, NULL, &nit); } /* Record LOOP as occuring in SCOP. Returns true when the operation @@ -3410,9 +3419,9 @@ build_scop_conditions_1 (VEC (gimple, heap) **conditions, bool res = true; int i, j; graphite_bb_p gbb; - gimple_stmt_iterator gsi; basic_block bb_child, bb_iter; VEC (basic_block, heap) *dom; + gimple stmt; /* Make sure we are in the SCoP. */ if (!bb_in_sese_p (bb, SCOP_REGION (scop))) @@ -3430,9 +3439,9 @@ build_scop_conditions_1 (VEC (gimple, heap) **conditions, dom = get_dominated_by (CDI_DOMINATORS, bb); - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + stmt = last_stmt (bb); + if (stmt) { - gimple stmt = gsi_stmt (gsi); VEC (edge, gc) *edges; edge e; @@ -4110,7 +4119,7 @@ rename_variables_in_stmt (gimple stmt, htab_t map) ssa_op_iter iter; use_operand_p use_p; - FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE) + FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES) { tree use = USE_FROM_PTR (use_p); tree new_name = get_new_name_from_old_name (map, use); @@ -4229,8 +4238,6 @@ expand_scalar_variables_expr (tree type, tree op0, enum tree_code code, tree new_name = force_gimple_operand_gsi (gsi, expr, true, NULL, true, GSI_SAME_STMT); - set_symbol_mem_tag (SSA_NAME_VAR (new_name), - symbol_mem_tag (SSA_NAME_VAR (old_name))); return fold_build1 (code, type, new_name); } @@ -4470,7 +4477,7 @@ graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb, htab_t map) operands. */ copy = gimple_copy (stmt); gsi_insert_after (&gsi_tgt, copy, GSI_NEW_STMT); - mark_symbols_for_renaming (copy); + mark_sym_for_renaming (gimple_vop (cfun)); region = lookup_stmt_eh_region (stmt); if (region >= 0) @@ -4479,7 +4486,7 @@ graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb, htab_t map) /* Create new names for all the definitions created by COPY and add replacement mappings for each new name. */ - FOR_EACH_SSA_DEF_OPERAND (def_p, copy, op_iter, SSA_OP_DEF) + FOR_EACH_SSA_DEF_OPERAND (def_p, copy, op_iter, SSA_OP_ALL_DEFS) { tree old_name = DEF_FROM_PTR (def_p); tree new_name = create_new_def_for (old_name, copy, def_p); @@ -4699,8 +4706,8 @@ translate_clast (scop_p scop, struct loop *context_loop, next_e, map); htab_delete (map); loop_iv_stack_remove_constants (ivstack); - update_ssa (TODO_update_ssa); recompute_all_dominators (); + update_ssa (TODO_update_ssa); graphite_verify (); return translate_clast (scop, context_loop, stmt->next, next_e, ivstack); } @@ -5877,7 +5884,7 @@ graphite_trans_loop_block (VEC (graphite_bb_p, heap) *bbs, int loops) bool transform_done = false; /* TODO: - Calculate the stride size automatically. */ - int stride_size = 64; + int stride_size = 51; for (i = 0; VEC_iterate (graphite_bb_p, bbs, i, gb); i++) transform_done |= graphite_trans_bb_block (gb, stride_size, loops);