Commit Graph

113 Commits

Author SHA1 Message Date
Steven Bosscher 7ee2468b92 system.h (dump_file): Do not define.
gcc/
	* system.h (dump_file): Do not define.
	* tree-pass.h: Include dumpfile.h, which is a new file containing...
	(enum tree_dump_index, TDF_*, get_dump_file_name, dump_enabled_p,
	dump_initialized_p, dump_begin, dump_end, dump_node, dump_switch_p,
	dump_flag_name, dump_file, dump_flags, dump_file_name,
	get_dump_file_info, struct dump_file_info): all of this, moved to...
	* dumpfile.h: Here, new file.
	* tree-dump.h: Include dumpfile.h, but not tree-pass.h.
	(dump_stmt): Remove prototype for C++ specific function.
	(dump_enumerated_decls): Move prototype from here...
	* tree-flow.h (dump_enumerated_decls): ... to here.
	(get_ref_base_and_extent) Move prototype from here ...
	* tree.h (get_ref_base_and_extent) ... to here.
	* tree-ssa-live.c: Do not inclde tree-pretty-print.h, because
	gimple-pretty-print.h is enough.  Do not include tree-dump.h,
	include timevar.h and dumpfile.h instead.
	(struct numbered_tree_d, compare_decls_by_uid,
	dump_enumerated_decls_push, dump_enumerated_decls): Move from here ...
	* tree-dfa.c:(struct numbered_tree_d, compare_decls_by_uid,
	dump_enumerated_decls_push, dump_enumerated_decls):... to here.
	Do not include timevar.h.
	* tree.c: Do not include timevar.h.
	* tree-cfg.c: Do not include langhooks.h, tree-pretty-print.h, and
	timevar.h.
	(dump_cfg_stats): Use current_function_name.
	(gimple_cfg2vcg): Likewise.
	(dump_function_to_file): Likewise.
	* df-scan.c: Do not include tree-pass.h and timevar.h.
	Include dumpfile.h.
	(df_entry_block_bitmap_verify, df_exit_block_bitmap_verify): Do not
	use print_current_pass.
	* df-problems.c: Include dumpfile.h.
	Always define REG_DEAD_DEBUGGING, avoid #ifdef code, because it
	leads to errors in the code not selected.
	(df_note_compute): Do not print_rtl_with_bb here.  Fix compilation
	bug if REG_DEAD_DEBUGGING is not 0, get_insns is not available here.
	* lcm.c: Include dumpfile.h.
	Remove obsolete include of insn-attr.h.
	* dojump.c (do_compare_rtx_and_jump): Remove failure printing for
	missing probability notes.
	* stmt.c: Include dumpfile.h.
	(emit_case_decision_tree): Re-enable printing expand details only
	if TDF_DETAILS.
	* alias.c, auto-inc-dec.c, bb-reorder.c, caller-save.c, cfg.c, 
	cfgcleanup.c, cfgexpand.c, cfgloop.c, cfgloopmanip.c, cgraph.c, 
	cgraphclones.c, cgraphunit.c, combine.c, combine-stack-adj.c, 
	coverage.c, cprop.c, cse.c, cselib.c, dbgcnt.c, dce.c, df-core.c, 
	dse.c, dwarf2out.c, emit-rtl.c, except.c, expr.c, final.c, 
	function.c, fwprop.c, gcse.c, gimple-fold.c, 
	gimple-pretty-print.c, gimple-ssa-strength-reduction.c, 
	gimplify.c, graphite-blocking.c, graphite-clast-to-gimple.c, 
	graphite-dependences.c, graphite-interchange.c, 
	graphite-optimize-isl.c, graphite-poly.c, 
	graphite-sese-to-poly.c, haifa-sched.c, hw-doloop.c, ifcvt.c, 
	ipa.c, ipa-cp.c, ipa-inline-analysis.c, ipa-inline.c, 
	ipa-inline-transform.c, ipa-prop.c, ipa-pure-const.c, 
	ipa-reference.c, ipa-split.c, ipa-utils.c, ira.c, ira-emit.c, 
	jump.c, loop-doloop.c, loop-init.c, loop-invariant.c, loop-iv.c, 
	loop-unroll.c, loop-unswitch.c, lower-subreg.c, 
	lto-section-out.c, lto-streamer-in.c, matrix-reorg.c, mcf.c, 
	mode-switching.c, modulo-sched.c, omega.c, omp-low.c, passes.c, 
	plugin.c, postreload.c, postreload-gcse.c, predict.c, print-rtl.c, 
	print-tree.c, profile.c, recog.c, ree.c, regcprop.c, reginfo.c, 
	regmove.c, regrename.c, reg-stack.c, reload1.c, reorg.c, 
	sched-rgn.c, sched-vis.c, sel-sched.c, sel-sched-ir.c, 
	store-motion.c, tracer.c, trans-mem.c, tree-affine.c, 
	tree-call-cdce.c, tree-cfgcleanup.c, tree-chrec.c, 
	tree-data-ref.c, tree-diagnostic.c, tree-dump.c,
	tree-eh.c, tree-flow-inline.h, tree-if-conv.c, tree-into-ssa.c, 
	tree-mudflap.c, tree-nrv.c, tree-object-size.c, 
	tree-optimize.c, tree-outof-ssa.c, tree-predcom.c, 
	tree-pretty-print.c, tree-profile.c, tree-scalar-evolution.c, 
	tree-sra.c, tree-ssa-address.c, tree-ssa-alias.c, tree-ssa.c, 
	tree-ssa-ccp.c, tree-ssa-coalesce.c, tree-ssa-copy.c, 
	tree-ssa-copyrename.c,, tree-ssa-dce.c, tree-ssa-dom.c, 
	tree-ssa-dse.c, tree-ssa-forwprop.c, tree-ssa-ifcombine.c, 
	tree-ssa-loop.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c, 
	tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c, 
	tree-ssa-loop-manip.c, tree-ssa-loop-niter.c, 
	tree-ssa-loop-prefetch.c, tree-ssa-loop-unswitch.c, 
	tree-ssa-math-opts.c, tree-ssa-operands.c, tree-ssa-phiopt.c, 
	tree-ssa-phiprop.c, tree-ssa-pre.c, tree-ssa-propagate.c, 
	tree-ssa-reassoc.c, tree-ssa-sccvn.c, tree-ssa-sink.c, 
	tree-ssa-structalias.c, tree-ssa-tail-merge.c, tree-ssa-ter.c, 
	tree-ssa-threadedge.c, tree-ssa-threadupdate.c, 
	tree-ssa-uncprop.c, tree-ssa-uninit.c, 
	tree-switch-conversion.c, tree-tailcall.c, 
	tree-vect-data-refs.c, tree-vect-loop.c, 
	tree-vect-loop-manip.c, tree-vectorizer.c, 
	tree-vect-patterns.c, tree-vect-slp.c, tree-vect-stmts.c, 
	tree-vrp.c, value-prof.c, var-tracking.c, web.c: Include tree-pass.h
	only if needed.  If tree-pass.h is included, do not include timevar.h
	and dumpfile.h.  If tree-pass.h is not included but dump_file, or
	dump_flags, or the TDF_* flags are used, include dumpfile.h.
	If gimple-pretty-print.h is included, don't include tree-pretty-print.h.
	Remove assorted unnecessary includes.

	* config/mn10300/mn10300.c, config/c6x/c6x.c, config/ia64/ia64.c,
	config/arm/arm.c, config/bfin/bfin.c, config/frv/frv.c,
	config/spu/spu.c, config/mep/mep.c, config/i386/i386.c:
	Include dumpfile.h.
	* config/rl78/rl78.c: Include dumpfile.h instead of tree-pass.h.
	* arm/t-arm, avr/t-avr, i386/t-i386, ia64/t-ia64, mep/t-mep,
	spu/t-spu-elf: Fix dependencies.

c-family/
	* c-gimplify.c: Include dumpfile.h instead of tree-dump.h.
	* c-ada-spec.c: Likewise.
	* c-dump.c (dump_stmt): Move to cp/dump.c, the only user.

c/
	* c-decl.c: Include dumpfile.h instead of tree-dump.h.
	* Make-lang.in: Fix dependencies.

cp/
	* dump.c (dump_stmt): Moved here from c-dump.c.
	* optimize.c: Include dumpfile.h instead of tree-dump.h.
	* class.c: Likewise.
	* decl2.c: Likewise.
	* Make-lang.in: Fix dependencies.

fortran/
	* f95-lang.c: Include dumpfile.h instead of tree-dump.h.
	* Make-lang.in: Fix dependencies.

java/
	* java-gimplify.c Include dumpfile.h instead of tree-dump.h
	* Make-lang.in: Fix dependencies.

lto/
	* lto.c: Do not include timevar.h.
	* Make-lang.in: Fix dependencies.

ada/
	* gcc-interface/utils.c: Include timevar.h.
	* Make-lang.in: Fix dependencies.

From-SVN: r189519
2012-07-16 11:32:42 +00:00
Dehao Chen 9e227d605e revert: tree.h (phi_arg_d): New field.
2012-07-16  Dehao Chen  <dehao@google.com>

	Revert
	2012-07-10  Dehao Chen  <dehao@google.com>

	* tree.h (phi_arg_d): New field.
	* tree-flow-inline.h (gimple_phi_arg_block): New function.
	(gimple_phi_arg_block_from_edge): New function.
	(gimple_phi_arg_set_block): New function.
	(gimple_phi_arg_has_block): New function.
	(redirect_edge_var_map_block): New function.
	* tree-flow.h (_edge_var_map): New field.
	* tree-ssa-live.c (remove_unused_locals): Mark phi_arg's block as used.
	* tree-eh.c (cleanup_empty_eh_merge_phis): Add block debug info for
	redirect_edge_var_map_add.
	* tree-outof-ssa.c (_elim_graph): New field.
	(insert_partition_copy_on_edge): New parameter.
	(insert_value_copy_on_edge): New parameter.
	(insert_rtx_to_part_on_edge): New parameter.
	(insert_part_to_rtx_on_edge): New parameter.
	(elim_graph_add_edge): New parameter.
	(elim_graph_remove_succ_edge): New parameter.
	(FOR_EACH_ELIM_GRAPH_SUCC): New parameter.
	(FOR_EACH_ELIM_GRAPH_PRED): New parameter.
	(new_elim_graph): Add block debug info.
	(clear_elim_graph): Likewise.
	(delete_elim_graph): Likewise.
	(elim_graph_add_node): Likewise.
	(elim_graph_add_edge): Likewise.
	(elim_graph_remove_succ_edge): Likewise.
	(eliminate_build): Likewise.
	(elim_forward): Likewise.
	(elim_unvisited_predecessor): Likewise.
	(elim_backward): Likewise.
	(elim_create): Likewise.
	(eliminate_phi): Likewise.
	(insert_backedge_copies): Likewise.
	* tree-into-ssa.c (insert_phi_nodes_for): Add block debug info for
	add_phi_arg.
	(rewrite_add_phi_arguments): Likewise.
	* tree-ssa-loop-im.c (execute_sm_if_changed): Likewise.
	* tree-ssa-tail-merge.c (replace_block_by): Likewise.
	* tree-ssa-threadupdate.c (copy_phi_args): Likewise.
	* tree-loop-distribution.c (update_phis_for_loop_copy): Likewise.
	* tree-ssa-loop-manip.c (create_iv): Likewise.
	(add_exit_phis_edge): Likewise.
	(split_loop_exit_edge): Likewise.
	(copy_phi_node_args): Likewise.
	(tree_transform_and_unroll_loop): Likewise.
	* value-prof.c (gimple_ic): Likewise.
	(gimple_stringop_fixed_value): Likewise.
	* tree-tailcall.c (add_successor_phi_arg): Likewise.
	(eliminate_tail_call): Likewise.
	(create_tailcall_accumulator): Likewise.
	(tree_optimize_tail_calls_1): Likewise.
	* tree-phinodes.c (add_phi_arg): Likewise.
	(make_phi_node): Likewise.
	(resize_phi_node): Likewise.
	(remove_phi_arg_num): Likewise.
	* omp-low.c (expand_parallel_call): Likewise.
	(expand_omp_for_static_chunk): Likewise.
	* tree-vect-loop-manip.c (slpeel_update_phis_for_duplicate_loop):
	Likewise.
	(slpeel_update_phi_nodes_for_guard1): Likewise.
	(slpeel_update_phi_nodes_for_guard2): Likewise.
	(slpeel_tree_duplicate_loop_to_edge_cfg): Likewise.
	(set_prologue_iterations): Likewise.
	(slpeel_tree_peel_loop_to_edge): Likewise.
	(vect_loop_versioning): Likewise.
	* tree-parloops.c (create_phi_for_local_result): Likewise.
	(transform_to_exit_first_loop): Likewise.
	(create_parallel_loop): Likewise.
	* ipa-split.c (split_function): Likewise.
	* tree-vect-loop.c (get_initial_def_for_induction): Likewise.
	(vect_create_epilog_for_reduction): Likewise.
	* tree-vect-data-refs.c (vect_setup_realignment): Likewise.
	* graphite-scop-detection.c (canonicalize_loop_closed_ssa): Likewise.
	* tree-ssa-phiopt.c (cond_store_replacement): Likewise.
	(cond_if_else_store_replacement_1): Likewise.
	* tree-cfgcleanup.c (remove_forwarder_block): Likewise.
	(remove_forwarder_block_with_phi): Likewise.
	* tree-ssa-pre.c (insert_into_preds_of_block): Likewise.
	* tree-predcom.c (initialize_root_vars): Likewise.
	(initialize_root_vars_lm): Likewise.
	* sese.c (sese_add_exit_phis_edge): Likewise.
	* tree-ssa-dce.c (forward_edge_to_pdom): Likewise.
	* tree-ssa.c (flush_pending_stmts): Likewise.
	(redirect_edge_var_map_add): Likewise.
	(ssa_redirect_edge): Likewise.
	* gimple-streamer-in.c (input_phi): Likewise.
	* tree-vect-stmts.c (vectorizable_load): Likewise.
	* tree-inline.c (copy_phis_for_bb): Likewise.
	* tree-ssa-phiprop.c (phiprop_insert_phi): Likewise.
	* tree-switch-conversion.c (fix_phi_nodes): Likewise.
	* tree-cfg.c (reinstall_phi_args): Likewise.
	(gimple_make_forwarder_block): Likewise.
	(add_phi_args_after_copy_edge): Likewise.
	(gimple_duplicate_sese_tail): Likewise.

From-SVN: r189518
2012-07-16 11:08:21 +00:00
Bill Schmidt c3e7ee4191 tm.texi: Regenerate.
2012-07-13  Bill Schmidt  <wschmidt@linux.ibm.com>

	* doc/tm.texi: Regenerate.
	* doc/tm.texi.in (TARGET_VECTORIZE_INIT_COST): New hook.
	(TARGET_VECTORIZE_ADD_STMT_COST): Likewise.
	(TARGET_VECTORIZE_FINISH_COST): Likewise.
	(TARGET_VECTORIZE_DESTROY_COST_DATA): Likewise.
	* targhooks.c (default_init_cost): New function.
	(default_add_stmt_cost): Likewise.
	(default_finish_cost): Likewise.
	(default_destroy_cost_data): Likewise.
	* targhooks.h (default_init_cost): New decl.
	(default_add_stmt_cost): Likewise.
	(default_finish_cost): Likewise.
	(default_destroy_cost_data): Likewise.
	* target.def (init_cost): New DEFHOOK.
	(add_stmt_cost): Likewise.
	(finish_cost): Likewise.
	(destroy_cost_data): Likewise.
	* target.h (struct _stmt_vec_info): New extern decl.
	(stmt_vectype): Likewise.
	(stmt_in_inner_loop_p): Likewise.
	* tree-vectorizer.h (stmt_info_for_cost): New struct/typedef.
	(stmt_vector_for_cost): New VEC/typedef.
	(add_stmt_info_to_vec): New function.
	(struct _slp_tree): Remove cost.inside_of_loop field.
	(struct _slp_instance): Remove cost.inside_of_loop field; add
	stmt_cost_vec field.
	(SLP_INSTANCE_INSIDE_OF_LOOP_COST): Remove macro.
	(SLP_INSTANCE_STMT_COST_VEC): New accessor macro.
	(SLP_TREE_INSIDE_OF_LOOP_COST): Remove macro.
	(struct _vect_peel_extended_info): Add stmt_cost_vec field.
	(struct _loop_vec_info): Add target_cost_data field.
	(LOOP_VINFO_TARGET_COST_DATA): New accessor macro.
	(struct _bb_vec_info): Add target_cost_data field.
	(BB_VINFO_TARGET_COST_DATA): New accessor macro.
	(struct _stmt_vec_info): Remove cost.inside_of_loop field.
	(STMT_VINFO_INSIDE_OF_LOOP_COST): Remove macro.
	(stmt_vinfo_set_inside_of_loop_cost): Remove function.
	(init_cost): New function.
	(add_stmt_cost): Likewise.
	(finish_cost): Likewise.
	(destroy_cost_data): Likewise.
	(vect_model_simple_cost): Change parameter list.
	(vect_model_store_cost): Likewise.
	(vect_model_load_cost): Likewise.
	(record_stmt_cost): New extern decl.
	(vect_get_load_cost): Change parameter list.
	(vect_get_store_cost): Likewise.
	* tree-vect-loop.c (new_loop_vec_info): Call init_cost.
	(destroy_loop_vec_info): Call destroy_cost_data.
	(vect_estimate_min_profitable_iters): Remove old calculation of
	inside costs; call finish_cost instead.
	(vect_model_reduction_cost): Call add_stmt_cost instead of old
	inside-costs calculation.
	(vect_model_induction_cost): Likewise.
	* tree-vect-data-refs.c (vect_get_data_access_cost): Change to
	return a stmt_vector_for_cost; modify calls to vect_get_load_cost
	and vect_get_store_cost to obtain the value to return.
	(vect_peeling_hash_get_lowest_cost): Obtain a stmt_cost_vec from
	vect_get_data_access_cost and store it in the minimum peeling
	structure.
	(vect_peeling_hash_choose_best_peeling): Change the parameter list
	to add a (stmt_vector_for_cost *) output parameter, and set its value.
	(vect_enhance_data_refs_alignment): Ignore the new return value from
	calls to vect_get_data_access_cost; obtain stmt_cost_vec from
	vect_peeling_hash_choose_best_peeling and pass its contents to the
	target cost model.
	* tree-vect-stmts.c (stmt_vectype): New function.
	(stmt_in_inner_loop_p): Likewise.
	(record_stmt_cost): Likewise.
	(vect_model_simple_cost): Add stmt_cost_vec parameter; call
	record_stmt_cost instead of old calculation; don't call
	stmt_vinfo_set_inside_of_loop_cost.
	(vect_model_promotion_demotion_cost): Call add_stmt_cost instead of
	old calculation; don't call stmt_vinfo_set_inside_of_loop_cost.
	(vect_model_store_cost): Add stmt_cost_vec parameter; call
	record_stmt_cost instead of old calculation; add stmt_cost_vec
	parameter to vect_get_store_cost call; don't call
	stmt_vinfo_set_inside_of_loop_cost.
	(vect_get_store_cost): Add stmt_cost_vec parameter; call
	record_stmt_cost instead of old calculation.
	(vect_model_load_cost): Add stmt_cost_vec parameter; call
	record_stmt_cost instead of old calculation; add stmt_cost_vec
	parameter to vect_get_load_cost call; don't call
	stmt_vinfo_set_inside_of_loop_cost.
	(vect_get_load_cost): Add stmt_cost_vec parameter; call
	record_stmt_cost instead of old calculation.
	(vectorizable_call): Add NULL parameter to vect_model_simple_cost call.
	(vectorizable_conversion): Likewise.
	(vectorizable_assignment): Likewise.
	(vectorizable_shift): Likewise.
	(vectorizable_operation): Likewise.
	(vectorizable_store): Add NULL parameter to vect_model_store_cost call.
	(vectorizable_load): Add NULL parameter to vect_model_load_cost call.
	(new_stmt_vec_info): Don't set STMT_VINFO_INSIDE_OF_LOOP_COST.
	* config/spu/spu.c (TARGET_VECTORIZE_INIT_COST): New macro def.
	(TARGET_VECTORIZE_ADD_STMT_COST): Likewise.
	(TARGET_VECTORIZE_FINISH_COST): Likewise.
	(TARGET_VECTORIZE_DESTROY_COST_DATA): Likewise.
	(spu_init_cost): New function.
	(spu_add_stmt_cost): Likewise.
	(spu_finish_cost): Likewise.
	(spu_destroy_cost_data): Likewise.
	* config/i386/i386.c (ix86_init_cost): New function.
	(ix86_add_stmt_cost): Likewise.
	(ix86_finish_cost): Likewise.
	(ix86_destroy_cost_data): Likewise.
	(TARGET_VECTORIZE_INIT_COST): New macro def.
	(TARGET_VECTORIZE_ADD_STMT_COST): Likewise.
	(TARGET_VECTORIZE_FINISH_COST): Likewise.
	(TARGET_VECTORIZE_DESTROY_COST_DATA): Likewise.
	* config/rs6000/rs6000.c (TARGET_VECTORIZE_INIT_COST): New macro def.
	(TARGET_VECTORIZE_ADD_STMT_COST): Likewise.
	(TARGET_VECTORIZE_FINISH_COST): Likewise.
	(TARGET_VECTORIZE_DESTROY_COST_DATA): Likewise.
	(rs6000_init_cost): New function.
	(rs6000_add_stmt_cost): Likewise.
	(rs6000_finish_cost): Likewise.
	(rs6000_destroy_cost_data): Likewise.
	* tree-vect-slp.c (vect_free_slp_instance): Free stmt_cost_vec.
	(vect_create_new_slp_node): Don't set SLP_TREE_INSIDE_OF_LOOP_COST.
	(vect_get_and_check_slp_defs): Add stmt_cost_vec parameter; add
	stmt_cost_vec parameter to vect_model_store_cost and
	vect_model_simple_cost calls.
	(vect_build_slp_tree): Remove inside_cost parameter; add stmt_cost_vec
	parameter; add stmt_cost_vec parameter to vect_get_and_check_slp_defs,
	vect_model_load_cost, and recursive vect_build_slp_tree calls; prevent
	calculating cost more than once for loads; remove inside_cost
	parameter from recursive vect_build_slp_tree calls; call
	record_stmt_cost instead of old calculation.
	(vect_analyze_slp_instance): Allocate stmt_cost_vec and save it with
	the instance; free it on premature exit; remove inside_cost parameter
	from vect_build_slp_tree call; add stmt_cost_vec parameter to
	vect_build_slp_tree call; don't set SLP_INSTANCE_INSIDE_OF_LOOP_COST.
	(new_bb_vec_info): Call init_cost.
	(destroy_bb_vec_info): Call destroy_cost_data.
	(vect_bb_vectorization_profitable_p): Call add_stmt_cost for each
	statement recorded with an SLP instance; call finish_cost instead of
	the old calculation.
	(vect_update_slp_costs_according_to_vf): Record statement costs from
	SLP instances, multiplying by the appropriate number of copies; don't
	update SLP_INSTANCE_INSIDE_OF_LOOP_COST.

From-SVN: r189460
2012-07-13 11:12:33 +00:00
Dehao Chen e53a3e778e tree.h (phi_arg_d): New field.
2012-07-10  Dehao Chen  <dehao@google.com>

	* tree.h (phi_arg_d): New field.
	* tree-flow-inline.h (gimple_phi_arg_block): New function.
	(gimple_phi_arg_block_from_edge): New function.
	(gimple_phi_arg_set_block): New function.
	(gimple_phi_arg_has_block): New function.
	(redirect_edge_var_map_block): New function.
	* tree-flow.h (_edge_var_map): New field.
	* tree-ssa-live.c (remove_unused_locals): Mark phi_arg's block
	as used.
	* tree-eh.c (cleanup_empty_eh_merge_phis): Add block debug info for
	redirect_edge_var_map_add.
	* tree-outof-ssa.c (_elim_graph): New field.
	(insert_partition_copy_on_edge): New parameter.
	(insert_value_copy_on_edge): New parameter.
	(insert_rtx_to_part_on_edge): New parameter.
	(insert_part_to_rtx_on_edge): New parameter.
	(elim_graph_add_edge): New parameter.
	(elim_graph_remove_succ_edge): New parameter.
	(FOR_EACH_ELIM_GRAPH_SUCC): New parameter.
	(FOR_EACH_ELIM_GRAPH_PRED): New parameter.
	(new_elim_graph): Add block debug info.
	(clear_elim_graph): Likewise.
	(delete_elim_graph): Likewise.
	(elim_graph_add_node): Likewise.
	(elim_graph_add_edge): Likewise.
	(elim_graph_remove_succ_edge): Likewise.
	(eliminate_build): Likewise.
	(elim_forward): Likewise.
	(elim_unvisited_predecessor): Likewise.
	(elim_backward): Likewise.
	(elim_create): Likewise.
	(eliminate_phi): Likewise.
	(insert_backedge_copies): Likewise.
	* tree-into-ssa.c (insert_phi_nodes_for): Add block debug info for
	add_phi_arg.
	(rewrite_add_phi_arguments): Likewise.
	* tree-ssa-loop-im.c (execute_sm_if_changed): Likewise.
	* tree-ssa-tail-merge.c (replace_block_by): Likewise.
	* tree-ssa-threadupdate.c (copy_phi_args): Likewise.
	* tree-loop-distribution.c (update_phis_for_loop_copy): Likewise.
	* tree-ssa-loop-manip.c (create_iv): Likewise.
	(add_exit_phis_edge): Likewise.
	(split_loop_exit_edge): Likewise.
	(copy_phi_node_args): Likewise.
	(tree_transform_and_unroll_loop): Likewise.
	* value-prof.c (gimple_ic): Likewise.
	(gimple_stringop_fixed_value): Likewise.
	* tree-tailcall.c (add_successor_phi_arg): Likewise.
	(eliminate_tail_call): Likewise.
	(create_tailcall_accumulator): Likewise.
	(tree_optimize_tail_calls_1): Likewise.
	* tree-phinodes.c (add_phi_arg): Likewise.
	(make_phi_node): Likewise.
	(resize_phi_node): Likewise.
	(remove_phi_arg_num): Likewise.
	* omp-low.c (expand_parallel_call): Likewise.
	(expand_omp_for_static_chunk): Likewise.
	* tree-vect-loop-manip.c (slpeel_update_phis_for_duplicate_loop):
	Likewise.
	(slpeel_update_phi_nodes_for_guard1): Likewise.
	(slpeel_update_phi_nodes_for_guard2): Likewise.
	(slpeel_tree_duplicate_loop_to_edge_cfg): Likewise.
	(set_prologue_iterations): Likewise.
	(slpeel_tree_peel_loop_to_edge): Likewise.
	(vect_loop_versioning): Likewise.
	* tree-parloops.c (create_phi_for_local_result): Likewise.
	(transform_to_exit_first_loop): Likewise.
	(create_parallel_loop): Likewise.
	* ipa-split.c (split_function): Likewise.
	* tree-vect-loop.c (get_initial_def_for_induction): Likewise.
	(vect_create_epilog_for_reduction): Likewise.
	* tree-vect-data-refs.c (vect_setup_realignment): Likewise.
	* graphite-scop-detection.c (canonicalize_loop_closed_ssa): Likewise.
	* tree-ssa-phiopt.c (cond_store_replacement): Likewise.
	(cond_if_else_store_replacement_1): Likewise.
	* tree-cfgcleanup.c (remove_forwarder_block): Likewise.
	(remove_forwarder_block_with_phi): Likewise.
	* tree-ssa-pre.c (insert_into_preds_of_block): Likewise.
	* tree-predcom.c (initialize_root_vars): Likewise.
	(initialize_root_vars_lm): Likewise.
	* sese.c (sese_add_exit_phis_edge): Likewise.
	* tree-ssa-dce.c (forward_edge_to_pdom): Likewise.
	* tree-ssa.c (flush_pending_stmts): Likewise.
	(redirect_edge_var_map_add): Likewise.
	(ssa_redirect_edge): Likewise.
	* gimple-streamer-in.c (input_phi): Likewise.
	* tree-vect-stmts.c (vectorizable_load): Likewise.
	* tree-inline.c (copy_phis_for_bb): Likewise.
	* tree-ssa-phiprop.c (phiprop_insert_phi): Likewise.
	* tree-switch-conversion.c (fix_phi_nodes): Likewise.
	* tree-cfg.c (reinstall_phi_args): Likewise.
	(gimple_make_forwarder_block): Likewise.
	(add_phi_args_after_copy_edge): Likewise.
	(gimple_duplicate_sese_tail): Likewise.

From-SVN: r189402
2012-07-10 04:28:32 +00:00
Bill Schmidt b6cef4e04d tree-vectorizer.h (vect_get_stmt_cost): Move from tree-vect-stmts.c.
2012-06-14  Bill Schmidt  <wschmidt@linux.ibm.com>

	* tree-vectorizer.h (vect_get_stmt_cost): Move from tree-vect-stmts.c.
	(cost_for_stmt): Remove decl.
	(vect_get_single_scalar_iteration_cost): Correct typo in name.
	* tree-vect-loop.c (vect_get_cost): Remove.
	(vect_get_single_scalar_iteration_cost): Correct typo in name; use
	vect_get_stmt_cost rather than vect_get_cost.
	(vect_get_known_peeling_cost): Use vect_get_stmt_cost rather than
	vect_get_cost.
	(vect_estimate_min_profitable_iters): Correct typo in call to
	vect_get_single_scalar_iteration_cost; use vect_get_stmt_cost rather
	than vect_get_cost.
	(vect_model_reduction_cost): Use vect_get_stmt_cost rather than
	vect_get_cost.
	(vect_model_induction_cost): Likewise.
	* tree-vect-data-refs.c (vect_peeling_hash_get_lowest_cost): Correct
	typo in call to vect_get_single_scalar_iteration_cost.
	* tree-vect-stmts.c (vect_get_stmt_cost): Move to tree-vectorizer.h.
	(cost_for_stmt): Remove unnecessary function.
	* Makefile.in (TREE_VECTORIZER_H): Update dependencies.

From-SVN: r188611
2012-06-14 12:21:36 +00:00
Richard Guenther 1fa0c18004 tree-data-ref.c (struct rdg_vertex_info): Remove.
2012-06-04  Richard Guenther  <rguenther@suse.de>

	* tree-data-ref.c (struct rdg_vertex_info): Remove.
	(rdg_vertex_for_stmt): Simplify using gimple_uid.
	(create_rdg_vertices): Pass loop argument, remove stmt to RDG index
	hashtable.   Record stmt data-references.
	(hash_stmt_vertex_info): Remove.
	(eq_stmt_vertex_info): Likewise.
	(hash_stmt_vertex_del): Likewise.
	(build_empty_rdg): Simplify.
	(build_rdg): Adjust.
	(free_rdg): Likewise.
	(ref_base_address): Remove.
	(have_similar_memory_accesses): Likewise.
	* tree-data-ref.h (create_rdg_vertices): Remove.
	(struct rdg_vertex): Add datarefs member.
	(RDGV_DATAREFS): New define.
	(RDG_DATAREFS): Likewise.
	(have_similar_memory_accesses): Remove.
	(rdg_has_similar_memory_accesses): Likewise.
	* tree-loop-distribution.c (ref_base_address): Re-implement here.
	(similar_memory_accesses): Re-implement using existing data-references.
	(tree_loop_distribution): Initialize stmt uids for the stmt to
	RDG index mapping.
	* tree-vect-loop.c (vect_create_epilog_for_reduction): Only
	access stmt vinfo for stmts in loop.

From-SVN: r188180
2012-06-04 13:18:16 +00:00
Steven Bosscher 6f4185d786 Makefile.in: Fix many dependencies.
* Makefile.in: Fix many dependencies.
	* tree-profile.c: Don't include regs.h.
	* tree-vectorizer.c: Don't include cfglayout.h.
	* tree-vect-stmts.c: Likewise.
	* tree-vect-slp.c: Likewise.
	* tree-vect-loop.c: Likewise.
	* reg-stack.c: Likewise.
	* tree-ssa-loop-manip.c: Likewise.
	* toplev.c: Likewise.
	* varasm.c: Don't include cfglayout.h, basic-block.h,
	and tree-iterator.h.
	* tree-cfgcleanup.c: Don't include cfglayout.h.
	* passes.c: Don't include cfglayout.h, dwarf2asm.h,
	dwarf2out.h, dbxout.h, sdbout.h, and xcoffout.h.
	* cgraphclones.c: Don't include plugin.h.

From-SVN: r188068
2012-05-31 16:43:31 +00:00
Jakub Jelinek 017a202055 re PR middle-end/53409 (ICE: vector VEC(vec_void_p,base) index domain error, in vinfo_for_stmt at tree-vectorizer.h:630)
PR tree-optimization/53409
	* tree-vect-loop.c (vect_analyze_loop_operations): Don't check
	vinfo_for_stmt (op_def_stmt) if op_def_stmt isn't inside loop.

	* gcc.c-torture/compile/pr53409.c: New test.

From-SVN: r187716
2012-05-21 16:27:10 +02:00
Richard Guenther 21039e0e00 re PR middle-end/53408 (ICE in get_initial_def_for_induction, at tree-vect-loop.c:3222)
2012-05-21  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/53408
	* tree-vect-loop.c (vectorizable_induction): Properly check
	the restriction that we cannot handle induction results from
	the inner loop outside of the outer loop.

	* gcc.dg/torture/pr53408.c: New testcase.

From-SVN: r187710
2012-05-21 12:45:59 +00:00
Richard Guenther 6ba840107a tree-vect-data-refs.c (vect_setup_realignment): Remove call to mark_symbols_for_renaming.
2012-05-14  Richard Guenther  <rguenther@suse.de>

	* tree-vect-data-refs.c (vect_setup_realignment): Remove
	call to mark_symbols_for_renaming.
	(vect_permute_load_chain): Likewise.
	* tree-vect-loop.c (vect_is_slp_reduction): Update stmt
	instead of calling mark_symbols_for_renaming.
	* tree-vect-stmts.c (read_vector_array): Remove call to
	mark_symbols_for_renaming.
	(write_vector_array): Likewise.
	(vectorizable_call): Likewise.
	(vectorizable_store): Likewise.
	(vectorizable_load): Likewise.
	* matrix-reorg.c (transform_allocation_sites): Likewise.
	* tree-ssa-pre.c (create_expression_by_pieces): Likewise.
	(create_expression_by_pieces): Likewise.

From-SVN: r187469
2012-05-14 15:06:40 +00:00
Richard Guenther 368117e868 tree-vectorizer.h (vect_loop_versioning): Adjust prototype.
2012-05-09  Richard Guenther  <rguenther@suse.de>

	* tree-vectorizer.h (vect_loop_versioning): Adjust prototype.
	(vect_do_peeling_for_loop_bound): Likewise.
	(vect_do_peeling_for_alignment): Likewise.
	* tree-vect-loop-manip.c (conservative_cost_threshold): Remove.
	(vect_do_peeling_for_loop_bound): Get check_profitability and
	threshold as parameters.
	(vect_do_peeling_for_alignment): Likewise.
	(vect_loop_versioning): Likewise.
	* tree-vect-loop.c (vect_transform_loop): Compute check_profitability
	and threshold here.  Control where to put the check here.

From-SVN: r187323
2012-05-09 11:01:16 +00:00
Michael Matz 355a767352 coretypes.h (gimple_seq, [...]): Typedef as gimple.
* coretypes.h (gimple_seq, const_gimple_seq): Typedef as gimple.
	* gimple.h (struct gimple_seq_node_d, struct gimple_seq_d): Remove.
	(const_gimple_seq_node): Remove.
	(gimple_seq_node): Typedef as gimple.
	(struct gimple_statement_base): Add next and prev members,
	adjust all WORD markers in using structs.
	(union gimple_statement_d): Link via gsbase.next field for GC and PCH.
	(gimple_seq_first, gimple_seq_first_stmt, gimple_seq_last,
	gimple_seq_last_stmt): Adjust as gimple_seq, gimple_seq_node and
	gimple are the same.
	(gimple_seq_set_last, gimple_seq_set_first): Don't allocate
	gimple_seq, adjust.
	(gimple_init_singleton): New function.
	(gsi_start_1, gsi_last_1, gsi_end_p, gsi_one_before_end_p): Adjust.
	(gsi_next, gsi_prev): Adjust, handle prev cyclic list correctly.
	(gsi_stmt): Adjust.
	(gsi_stmt_ptr): Remove.
	(enum gimple_alloc_kind): Remove gimple_alloc_kind_seq member.

	* gimple-iterator.c (update_bb_for_stmts): Take last parameter
	again, adjust for above changes.
	(update_call_edge_frequencies): Adjust for above changes.
	(gsi_insert_seq_nodes_before): Rewrite for new data structure.
	(gsi_insert_seq_nodes_after): Ditto.
	(gsi_split_seq_after): Ditto.
	(gsi_set_stmt): Ditto.
	(gsi_split_seq_before): Ditto.
	(gsi_remove): Ditto.
	(gsi_insert_seq_before_without_update): Don't free sequence.
	(gsi_insert_seq_after_without_update): Ditto.
	(gsi_replace): Assert some more invariants.
	(gsi_insert_before_without_update, gsi_insert_after_without_update):
	Tidy.
	(gsi_for_stmt): Don't search for stmt.
	(gsi_insert_on_edge_immediate): Tidy.

	* gimple.c (gimple_alloc_k): Remove "sequences".
	(gimple_seq_cache): Remove.
	(gimple_alloc_stat): Make stmt a singleton sequence.
	(gimple_seq_alloc, gimple_seq_free): Remove.
	(gimple_assign_set_rhs_with_ops_1): Ensure new stmt is a singleton.
	(gimple_copy): Ditto.
	* gimplify.c (gimplify_cleanup_point_expr): Use gsi_set_stmt,
	create iterator from correct sequence.
	* tree-phinodes.c (make_phi_node): Make stmt a singleton.


	* gimple.h (gimple_stmt_iterator <seq>): Make it be pointer to
	gimple_seq.
	(gimple_seq_set_last, gimple_seq_set_first): Take pointer to
	sequence, lazily allocate it.
	(bb_seq_addr): New function.
	(gsi_start_1): Rename from gsi_start, but take pointer to sequence.
	(gsi_start): Macro to wrap gsi_start_1 taking pointer of argument.
	(gsi_none): New function.
	(gsi_start_bb): Adjust.
	(gsi_last_1): Rename from gsi_last, but take pointer to sequence.
	(gsi_last): Macro to wrap gsi_last_1 taking pointer of argument.
	(gsi_last_bb): Adjust.
	(gsi_seq): Adjust.
	* tree-flow-inline.h (phi_nodes_ptr): New function.

	* gimple-iterator.c (gsi_insert_seq_nodes_before): Adjust to 
	datastructure and interface change.
	(gsi_insert_seq_before_without_update): Ditto.
	(gsi_insert_seq_nodes_after): Ditto.
	(gsi_insert_seq_after_without_update): Ditto.
	(gsi_split_seq_after): Ditto, don't use gimple_seq_alloc.
	(gsi_split_seq_before): Ditto.
	(gsi_start_phis): Adjust.
	* tree-vect-loop.c (vect_determine_vectorization_factor): Use
	gsi_none.
	(vect_transform_loop): Ditto.
	* gimple.c (gimple_seq_add_stmt, gimple_seq_add_seq,
	gimple_seq_copy): Don't use gimple_seq_alloc.
	* gimplify.c (gimple_seq_add_stmt_without_update): Ditto.
	(gimplify_seq_add_seq): Ditto.
	* lto-streamer-in.c (make_new_block): Ditto.
	* tree-cfg.c (create_bb): Ditto.
	* tree-sra.c (initialize_parameter_reductions): Ditto.


	* gimple.h (gimple_seq_first, gimple_seq_first_stmt, gimple_seq_last,
	gimple_seq_last_stmt, gimple_seq_set_last, gimple_seq_set_first,
	gimple_seq_empty_p, gimple_seq_alloc_with_stmt, bb_seq,
	set_bb_seq): Move down to after gimple_statement_d definition.


	* gimple-fold.c (gimplify_and_update_call_from_tree): Use
	gsi_replace_with_seq, instead of inserting itself.
	* gimple-iterator.c (gsi_replace_with_seq): New function.
	* tree-ssa-forwprop.c (forward_propagate_comparison): Take
	iterator instead of statement, advance it.
	(ssa_forward_propagate_and_combine): Adjust call to above.


	* tree-phinodes.c (add_phi_node_to_bb): Tidy, don't use
	gimple_seq_alloc.
	* omp-low.c (finalize_task_copyfn): Don't use gimple_seq_alloc.
	* tree-nested.c (walk_gimple_omp_for): Ditto.
	* trans-mem.c (lower_transaction): Ditto.
	* tree-eh.c (do_return_redirection): Ditto.
	(do_goto_redirection): Ditto.
	(lower_try_finally_switch): Ditto.
	* gimplify.c (gimplify_stmt): Ditto.
	(gimplify_scan_omp_clauses): Ditto.
	(gimplify_omp_for): Ditto.
	(gimplify_function_tree): Ditto.
	* gimple-fold.c (gimplify_and_update_call_from_tree): Ditto.
	* tree-mudflap.c (mf_decl_cache_locals): Ditto.
	(mf_build_check_statement_for): Ditto.
	(mx_register_decls): Ditto.
	* graphite-sese-to-poly.c (remove_invariant_phi): Ditto,
	and don't use itertors to append.
	(insert_stmts): Ditto.
	(insert_out_of_ssa_copy): Ditto.
	(insert_out_of_ssa_copy_on_edge): Ditto.


	* gimple.h (gimple_bind_body_ptr): New function.
	(gimple_bind_body): Use it.
	(gimple_catch_handler): Use gimple_catch_handler_ptr.
	(gimple_eh_filter_failure_ptr): New function.
	(gimple_eh_filter_failure): Use it.
	(gimple_eh_else_n_body_ptr): New function.
	(gimple_eh_else_n_body): Use it.
	(gimple_eh_else_e_body_ptr): New function.
	(gimple_eh_else_e_body): Use it.
	(gimple_try_eval_ptr): New function.
	(gimple_try_eval): Use it.
	(gimple_try_cleanup_ptr): New function.
	(gimple_try_cleanup): Use it.
	(gimple_wce_cleanup_ptr): New function.
	(gimple_wce_cleanup): Use it.
	(gimple_omp_body_ptr): New function.
	(gimple_omp_body): Use it.
	(gimple_omp_for_pre_body_ptr): New function.
	(gimple_omp_for_pre_body): Use it.
	(gimple_transaction_body_ptr): New function.
	(gimple_transaction_body): Use it.
	(gsi_split_seq_before): Adjust to return nothing and take pointer
	to sequence.
	(gsi_set_stmt): Declare.
	(gsi_replace_with_seq): Declare.
	(walk_gimple_seq_mod): Declare.
	* function.h (struct function <gimple_body>): Use typedef gimple_seq.

	* gimple-iterator.c (gsi_set_stmt): New function.
	(gsi_split_seq_before): Return new sequence via pointer argument.
	(gsi_replace): Use gsi_set_stmt.

	* tree-ssa-loop-im.c (move_computations_stmt): First remove
	then insert stmt.
	* tree-complex.c (update_complex_components_on_edge): Don't
	copy gsi.
	* tree-phinodes.c (resize_phi_node): Don't resize stmt in-place,
	return new stmt.
	(reserve_phi_args_for_new_edge): Change call to above,
	use gsi_set_stmt.

	* omp-low.c (lower_omp): Change prototype to take pointer to
	sequence.
	(lower_rec_input_clauses): Use gimple_seq_add_seq instead of
	iterators.  Adjust call to lower_omp.
	(lower_lastprivate_clauses): Adjust call to lower_omp.
	(lower_reduction_clauses): Ditto.
	(expand_omp_taskreg): Nullify non-cfg body of child_fn.
	(lower_omp_sections): Don't explicitely count sequence length,
	nullify lowered bodies earlier, ensure stmts are part of only
	one sequence, adjust call to lower_omp.
	(lower_omp_single): Ensure stmts are part of only one sequence,
	adjust call to lower_omp.
	(lower_omp_master): Ditto.
	(lower_omp_ordered): Ditto.
	(lower_omp_critical): Ditto.
	(lower_omp_for): Ditto.
	(lower_omp_taskreg): Ditto, tidy.
	(lower_omp_1): Adjust calls to lower_omp.
	(execute_lower_omp): Ditto.
	(lower_omp): Adjust to take pointer to sequence.
	(diagnose_sb_2): Use walk_gimple_seq_mod.
	(diagnose_omp_structured_block_errors): Ditto and set possibly
	changed function body.
	* gimple-low.c (lower_function_body): Set function body after
	it stabilizes.
	(lower_sequence): Adjust to take pointer to sequence.
	(lower_omp_directive): Ensure stmt isn't put twice into the
	sequence, adjust call to lower_sequence.
	(lower_stmt): Adjust calls to lower_sequence.
	(lower_gimple_bind): Ditto.
	(gimple_try_catch_may_fallthru): Call gsi_start with lvalue.
	* tree-nested.c (walk_body): Take pointer to sequence, use
	walk_gimple_seq_mod.
	(walk_function): Adjust call to walk_body, set possibly changed
	body.
	(walk_gimple_omp_for): Adjust calls to walk_body.
	(convert_nonlocal_omp_clauses): Ditto.
	(convert_nonlocal_reference_stmt): Ditto.
	(convert_local_omp_clauses): Ditto.
	(convert_local_reference_stmt): Ditto.
	(convert_tramp_reference_stmt): Ditto.
	(convert_gimple_call): Ditto.
	(convert_nl_goto_reference): Use local iterator copy.
	* gimple.c (walk_gimple_seq_mod): Renamed from walk_gimple_seq,
	but taking pointer to sequence, ensure gsi_start is called with
	callers lvalue.
	(walk_gimple_seq): New wrapper around walk_gimple_seq_mod,
	asserting that the sequence head didn't change.
	(walk_gimple_stmt): Replace all calls to walk_gimple_seq with
	walk_gimple_seq_mod.
	* trans-mem.c (lower_transaction): Use walk_gimple_seq_mod.
	(execute_lower_tm): Ditto, and set possibly changed body.
	* tree-eh.c (lower_eh_constructs_1): Take pointer to sequence,
	call gsi_start with that lvalue.
	(replace_goto_queue_stmt_list): Ditto.
	(replace_goto_queue_1): Adjust calls to replace_goto_queue_stmt_list.
	(replace_goto_queue): Ditto.
	(lower_try_finally_nofallthru): Adjust calls to lower_eh_constructs_1.
	(lower_try_finally_onedest): Ditto.
	(lower_try_finally_copy): Ditto.
	(lower_try_finally_switch): Ditto.
	(lower_try_finally): Ditto.
	(lower_eh_filter): Ditto.
	(lower_eh_must_not_throw): Ditto.
	(lower_cleanup): Ditto.
	(lower_eh_constructs_2): Ditto.
	(lower_catch): Ditto, and ensure gsi_start is called with lvalue.
	(lower_eh_constructs): Adjust calls to lower_eh_constructs_1, and
	set possibly changed body.
	(optimize_double_finally): Call gsi_start with lvalue.

	* tree-cfg.c (make_blocks): Adjust call to gsi_split_seq_before.
	(gimple_split_block): Ditto.
	(gimple_merge_blocks): Use gsi_start_phis.
	(move_stmt_r): Use walk_gimple_seq_mod.
	* tree-ssa-dse.c (dse_enter_block): Use gsi_last_bb.
	* cgraphbuild.c (build_cgraph_edges): Use gsi_start_phis.
	(rebuild_cgraph_edges): Ditto.
	(cgraph_rebuild_references): Ditto.
	* ipa-prop.c (ipa_analyze_params_uses): Ditto.
	* tree-inline.c (copy_phis_for_bb): Ditto.
	* tree-ssa-dce.c: Ditto.

	* cgraphunit.c (cgraph_analyze_function): Use gimple_has_body_p.

From-SVN: r187053
2012-05-02 16:41:48 +00:00
Richard Guenther d68d56b57f tree-vectorizer.h (vect_loop_versioning): Adjust prototype.
2012-04-25  Richard Guenther  <rguenther@suse.de>

	* tree-vectorizer.h (vect_loop_versioning): Adjust prototype.
	* tree-vect-loop.c (vect_transform_loop): Adjust.
	* tree-vect-loop-manip.c (vect_do_peeling_for_loop_bound): Record
	the maximum number of iterations for the epilogue loop.
	(vect_loop_versioning): Remove case re-using the peeled
	epilogue loop.

From-SVN: r186813
2012-04-25 11:19:08 +00:00
Richard Guenther e1b435ad06 re PR tree-optimization/53098 (tree-vect-loop.c:1414:19: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare])
2012-04-24  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/53098
	* tree-vect-loop.c (vect_analyze_loop_operations): Fixup
	comparison sign.

From-SVN: r186754
2012-04-24 08:06:20 +00:00
Richard Guenther 552fd8e693 tree-vect-loop.c (vect_analyze_loop_operations): Do not vectorize loops that can never run more often than the vectorization factor.
2012-04-20  Richard Guenther  <rguenther@suse.de>

	* tree-vect-loop.c (vect_analyze_loop_operations): Do not
	vectorize loops that can never run more often than the
	vectorization factor.

From-SVN: r186614
2012-04-20 08:19:49 +00:00
Michael Matz 0d0293ace6 tree-vectorizer.h (_loop_vec_info.strided_stores): Rename to grouped_stores.
* tree-vectorizer.h (_loop_vec_info.strided_stores): Rename to
	grouped_stores.
	(LOOP_VINFO_STRIDED_STORES): Rename to LOOP_VINFO_GROUPED_STORES.
	(struce _bb_vec_info.strided_stores): Rename to grouped_stores.
	(BB_VINFO_STRIDED_STORES): Rename to BB_VINFO_GROUPED_STORES.
	(STMT_VINFO_STRIDED_ACCESS): Rename to STMT_VINFO_GROUPED_ACCESS.
	(vect_strided_store_supported): Rename to vect_grouped_store_supported.
	(vect_strided_load_supported): Rename to vect_grouped_load_supported.
	(vect_transform_strided_load): Rename to vect_transform_grouped_load.
	(vect_record_strided_load_vectors): Rename to
	vect_record_grouped_load_vectors.
	* tree-vect-data-refs.c (vect_update_misalignment_for_peel):
	Rename use of above macros.
	(vect_verify_datarefs_alignment): Ditto.
	(vector_alignment_reachable_p): Ditto.
	(vect_peeling_hash_get_lowest_cost): Ditto.
	(vect_enhance_data_refs_alignment): Ditto.
	(vect_analyze_group_access): Ditto and rename stride to groupsize.
	(vect_analyze_data_ref_access): Rename "strided" to "grouped".
	(vect_strided_store_supported): Rename to vect_grouped_store_supported.
	(vect_strided_load_supported): Rename to vect_grouped_load_supported.
	(vect_transform_strided_load): Rename to vect_transform_grouped_load.
	(vect_record_strided_load_vectors): Rename to
	vect_record_grouped_load_vectors.
	* tree-vect-loop.c (new_loop_vec_info): Rename use of above macros.
	(destroy_loop_vec_info): Ditto.
	(vect_transform_loop): Ditto and rename strided_store to grouped_store.
	* tree-vect-slp.c (vect_build_slp_tree): Rename use of above macros.
	(vect_analyze_slp): Ditto.
	(new_bb_vec_info): Ditto.
	(destroy_bb_vec_info): Ditto.
	(vect_schedule_slp_instance): Ditto and rename strided_store to
	grouped_store.
	* tree-vect-stmts.c (vect_cost_strided_group_size): Rename to
	vect_cost_group_size.
	(vect_model_store_cost): Rename use of above macros and call
	to vect_cost_strided_group_size.
	(vect_model_load_cost): Ditto.
	(vectorizable_store): Ditto, rename strided_store to grouped_store
	and calls to renamed tree-vectorizer.h functions.
	(vectorizable_load): Ditto.
	(vect_transform_stmt): Rename use of above macros and strided_store
	to grouped_store.

testsuite/
	* gcc.dg/vect/vect-outer-1-big-array.c: Adjust.
	* gcc.dg/vect/vect-outer-1.c: Adjust.
	* gcc.dg/vect/vect-outer-1a-big-array.c: Adjust.
	* gcc.dg/vect/vect-outer-1a.c: Adjust.
	* gcc.dg/vect/vect-outer-1b-big-array.c: Adjust.
	* gcc.dg/vect/vect-outer-1b.c: Adjust.
	* gcc.dg/vect/vect-outer-2b.c: Adjust.
	* gcc.dg/vect/vect-outer-3b.c: Adjust.

From-SVN: r186285
2012-04-10 16:09:03 +00:00
Richard Guenther 3d3f224949 tree-nrv.c (tree_nrv): Release VDEFs.
2012-04-05  Richard Guenther  <rguenther@suse.de>

	* tree-nrv.c (tree_nrv): Release VDEFs.
	* tree-sra.c (sra_modify_constructor_assign): Likewise.
	(sra_modify_assign): Likewise.
	* tree-vect-stmts.c (vect_remove_stores): Likewise.
	* tree-vect-loop.c (vect_transform_loop): Likewise.
	* tree-ssa-dom.c (optimize_stmt): Likewise.
	* tree-vect-slp.c (vect_schedule_slp): Likewise.
	* tree-ssa-math-opts.c (execute_cse_sincos): Likewise.

From-SVN: r186160
2012-04-05 09:45:18 +00:00
Richard Guenther ad5d161a75 re PR middle-end/52701 (416.gamess in SPEC CPU 2006 failed to build)
2012-03-26  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/52701
	* tree-vect-loop.c (vect_analyze_scalar_cycles_1): Always
	compute and set the evolution part of PHI nodes.

	* gfortran.dg/pr52701.f90: New testcase.

From-SVN: r185800
2012-03-26 14:14:51 +00:00
Richard Guenther 0ac168a1cd re PR tree-optimization/52678 (internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842)
2012-03-23  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/52678
	* tree-vectorizer.h (struct _stmt_vec_info): Add
	loop_phi_evolution_part member.
	(STMT_VINFO_LOOP_PHI_EVOLUTION_PART): New define.
	* tree-vect-loop.c (vect_analyze_scalar_cycles_1): Initialize
	STMT_VINFO_LOOP_PHI_EVOLUTION_PART.
	* tree-vect-loop-manip.c (vect_update_ivs_after_vectorizer):
	Use the cached evolution part and the PHI nodes value from
	the loop preheader edge instead of re-analyzing the evolution.

	* gfortran.dg/pr52678.f: New testcase.

From-SVN: r185734
2012-03-23 11:34:32 +00:00
Richard Guenther 50a763ab47 tree-vect-loop.c (get_initial_def_for_induction): Use build_constructor directly.
2012-03-16  Richard Guenther  <rguenther@suse.de>

	* tree-vect-loop.c (get_initial_def_for_induction): Use
	build_constructor directly.
	* tree-vect-stmts.c (vect_get_vec_def_for_operand): Use
	build_vector_from_val.
	* tree.c (build_vector_from_val): Avoid creating a constructor
	first when we want a constant vector.

From-SVN: r185461
2012-03-16 09:54:36 +00:00
Richard Guenther d2a12ae77f tree.h (TREE_VECTOR_CST_ELTS): Remove.
2012-03-16  Richard Guenther  <rguenther@suse.de>

	* tree.h (TREE_VECTOR_CST_ELTS): Remove.
	(VECTOR_CST_NELTS, VECTOR_CST_ELTS, VECTOR_CST_ELT): New defines.
	(struct tree_vector): Remove elements member, add variable size
	elts array member.
	(build_vector_stat): Declare.
	(build_vector): Define in terms of build_vector_stat.
	* tree.c (build_vector): Rename to ...
	(build_vector_stat): ... this.  Take array of trees as parameter.
	(build_vector_from_ctor): Adjust.
	(integer_zerop, integer_onep, integer_all_onesp, iterative_hash_expr,
	initializer_zerop): Adjust.
	* cfgexpand.c (expand_debug_expr): Likewise.
	* expr.c (categorize_ctor_elements_1, expand_expr_real_1,
	const_vector_from_tree): Likewise.
	* fold-const.c (const_binop, operand_equal_p, native_encode_vector,
	native_interpret_vector, fold_unary_loc, vec_cst_ctor_to_array,
	fold_vec_perm, fold_binary_loc, fold_ternary_loc): Likewise.
	* tree-streamer-in.c (streamer_alloc_tree): Handle TS_VECTOR.
	(lto_input_ts_vector_tree_pointers): Adjust.
	* tree-streamer-out.c (streamer_write_tree_header): Handle TS_VECTOR.
	(write_ts_vector_tree_pointers): Adjust.
	* varasm.c (const_hash_1, compare_constant, copy_constant,
	output_constant): Adjust.
	* gimple-fold.c (gimple_fold_stmt_to_constant_1): Adjust.
	* print-tree.c (print_node): Adjust.
	* tree-pretty-print.c (dump_generic_node): Adjust.
	* tree-vect-generic.c (uniform_vector_p, vector_element,
	lower_vec_perm): Adjust.
	* tree-vect-loop.c (get_initial_def_for_reduction): Adjust.
	* tree-vect-slp.c (vect_get_constant_vectors,
	vect_transform_slp_perm_load): Adjust.
	* tree-vect-stmts.c (vect_gen_perm_mask): Adjust.
	* expmed.c (make_tree): Adjust.

	* config/i386/i386.c (ix86_expand_builtin): Adjust.
	* config/sparc/sparc.c (sparc_handle_vis_mul8x16): Adjust interface
	and implementation.
	(sparc_fold_builtin): Adjust.

	c-family/
	* c-pretty-print.c (pp_c_initializer_list): Adjust.

From-SVN: r185458
2012-03-16 09:47:09 +00:00
Ira Rosen f570918365 tree-vectorizer.h (vect_pattern_recog): Add new argument.
ChangeLog:

	* tree-vectorizer.h (vect_pattern_recog): Add new argument.
	* tree-vect-loop.c (vect_analyze_loop_2): Update call to
	vect_pattern_recog.
	* tree-vect-patterns.c (widened_name_p): Pass basic block
	info to vect_is_simple_use.
	(vect_recog_dot_prod_pattern): Fail for basic blocks.
	(vect_recog_widen_sum_pattern): Likewise.
	(vect_handle_widen_op_by_const): Support basic blocks.
	(vect_operation_fits_smaller_type,
	vect_recog_over_widening_pattern): Likewise.
	(vect_recog_vector_vector_shift_pattern): Support basic blocks.
	Update call to vect_is_simple_use.
	(vect_recog_mixed_size_cond_pattern): Support basic blocks.
	Add printing.
	(check_bool_pattern): Add an argument, update call to
	vect_is_simple_use and the recursive calls.
	(vect_recog_bool_pattern): Update relevant function calls.
	Add printing.
	(vect_mark_pattern_stmts): Update calls to new_stmt_vec_info.
	(vect_pattern_recog_1): Check for reduction only in loops.
	(vect_pattern_recog): Add new argument.  Support basic blocks.
	* tree-vect-stmts.c (vectorizable_conversion): Pass basic block
	info to vect_is_simple_use_1.
	* tree-vect-slp.c (vect_get_and_check_slp_defs): Support basic
	blocks.
	(vect_slp_analyze_bb_1): Call vect_pattern_recog.

testsuite/ChangeLog:

	* gcc.dg/vect/bb-slp-pattern-1.c: New test.
	* gcc.dg/vect/bb-slp-pattern-2.c: New test.

Co-Authored-By: Ulrich Weigand <ulrich.weigand@linaro.org>

From-SVN: r185436
2012-03-15 16:36:48 +00:00
Bill Schmidt 8bd373026e re PR tree-optimization/50031 (Sphinx3 has a 10% regression going from GCC 4.5 to GCC 4.6 on powerpc)
2012-02-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
	    Ira Rosen  <irar@il.ibm.com>

	PR tree-optimization/50031
	* targhooks.c (default_builtin_vectorization_cost): Handle
	vec_promote_demote.
	* target.h (enum vect_cost_for_stmt): Add vec_promote_demote.
	* tree-vect-loop.c (vect_get_single_scalar_iteraion_cost): Handle
	all types of reduction and pattern statements.
	(vect_estimate_min_profitable_iters): Likewise.
	* tree-vect-stmts.c (vect_model_promotion_demotion_cost): New function.
	(vect_get_load_cost): Use vec_perm for permutations; add dump logic
	for explicit realigns.
	(vectorizable_conversion): Call vect_model_promotion_demotion_cost.
	* config/spu/spu.c (spu_builtin_vectorization_cost): Handle
	vec_promote_demote.
	* config/i386/i386.c (ix86_builtin_vectorization_cost): Likewise.
	* config/rs6000/rs6000.c (rs6000_builtin_vectorization_cost): Update
	vec_perm for VSX and handle vec_promote_demote.


Co-Authored-By: Ira Rosen <irar@il.ibm.com>

From-SVN: r184102
2012-02-10 16:38:37 +00:00
Ira Rosen 24ee13842e re PR tree-optimization/52091 (ICE: verify_gimple failed)
PR tree-optimization/52091
        * tree-vectorizer.h (vect_is_simple_use): Add an argument.
        (vect_is_simple_use_1): Likewise.
        * tree-vect-loop.c (vectorizable_reduction): Update calls
        to vect_is_simple_use_1 and vect_is_simple_use.
        (vectorizable_live_operation): Likewise.
        * tree-vect-patterns.c (widened_name_p,
        vect_recog_vector_vector_shift_pattern, check_bool_pattern):
        Likewise.
        * tree-vect-stmts.c (process_use, vect_get_vec_def_for_operand,
        vectorizable_call, vectorizable_conversion,
        vectorizable_assignment, vectorizable_shift,
        vectorizable_operation, vectorizable_store, vectorizable_load):
        Likewise.
        (vect_is_simple_cond): Add an argument, pass it to
        vect_is_simple_use_1.
        (vectorizable_condition): Update calls to vect_is_simple_cond,
        vect_is_simple_use.
        (vect_is_simple_use): Add an argument, the statement in which
        OPERAND is used.  Check that if OPERAND's def stmt is a double
        reduction phi node, the use is a phi node too.
        (vect_is_simple_use_1): Add an argument, pass it to
        vect_is_simple_use.
        * tree-vect-slp.c (vect_get_and_check_slp_defs): Update a call
        to vect_is_simple_use.

From-SVN: r183902
2012-02-05 05:58:18 +00:00
Jakub Jelinek 363477c0bd tree-vectorizer.h (struct _stmt_vec_info): Remove pattern_def_stmt field, add pattern_def_seq.
* tree-vectorizer.h (struct _stmt_vec_info): Remove pattern_def_stmt
	field, add pattern_def_seq.
	(STMT_VINFO_PATTERN_DEF_STMT): Remove.
	(STMT_VINFO_PATTERN_DEF_SEQ): Define.
	(NUM_PATTERNS): Bump to 10.
	* tree-vect-loop.c (vect_determine_vectorization_factor,
	vect_transform_loop): Adjust for pattern def changing from a single
	gimple stmt to gimple_seq.
	* tree-vect-stmts.c (vect_analyze_stmt, new_stmt_vec_info,
	free_stmt_vec_info): Likewise.
	* tree-vect-patterns.c (vect_recog_over_widening_pattern,
	vect_recog_vector_vector_shift_pattern,
	vect_recog_mixed_size_cond_pattern, adjust_bool_pattern_cast,
	adjust_bool_pattern, vect_mark_pattern_stmts): Likewise.
	(vect_recog_sdivmod_pow2_pattern): New function.
	(vect_vect_recog_func_ptrs): Add it.

	* config/i386/sse.md (vcond<V_256:mode><VI_256:mode>,
	vcond<V_128:mode><VI124_128:mode>, vcond<VI8F_128:mode>v2di):
	Use general_operand instead of nonimmediate_operand for
	operand 5 and no predicate for operands 1 and 2.
	* config/i386/i386.c (ix86_expand_int_vcond): Optimize
	x < 0 ? -1 : 0 and x < 0 ? 1 : 0 into vector arithmetic
	resp. logical shift.

	* gcc.dg/vect/vect-sdivmod-1.c: New test.

From-SVN: r182388
2011-12-15 21:47:29 +01:00
Ira Rosen 64d949597c re PR middle-end/51285 (internal compiler error: in check_loop_closed_ssa_use, at tree-ssa-loop-manip.c)
PR middle-end/51285
        * tree-vect-loop.c (vect_create_epilog_for_reduction): Create
        exit phi nodes for outer loop in case of double reduction.

From-SVN: r181990
2011-12-04 14:52:01 +00:00
Jakub Jelinek 78048b1c66 re PR tree-optimization/51000 (ICE: in vect_get_store_cost, at tree-vect-stmts.c:923 on powerpc-apple-darwin9)
PR tree-optimization/51000
	* tree-vect-patterns.c (vect_recog_bool_pattern): If adding
	a pattern stmt for a bool store, adjust DR_STMT too.
	Don't handle bool conversions to single bit precision lhs.
	* tree-vect-stmts.c (vect_remove_stores): If next is a pattern
	stmt, remove its related stmt and free its stmt_vinfo.
	(free_stmt_vec_info): Free also pattern stmt's vinfo and
	pattern def stmt's vinfo.
	* tree-vect-loop.c (destroy_loop_vec_info): Don't try to
	free pattern stmt's vinfo here.
	(vect_transform_loop): When calling vect_remove_stores,
	do gsi_next first and don't call gsi_remove.  If not strided
	store, free stmt vinfo for gsi_stmt (si) rather than stmt.

	* gcc.dg/vect/pr51000.c: New test.

From-SVN: r181250
2011-11-10 09:29:52 +01:00
Ira Rosen 9b858c880b re PR tree-optimization/51015 (ice in vect_determine_vectorization_factor with -O3)
PR tree-optimization/51015
        * tree-vect-loop.c (vect_determine_vectorization_factor): Expect
        vectype to be set for pattern def stmts.

From-SVN: r181191
2011-11-09 06:41:59 +00:00
Ira Rosen f7e531cf98 tree-vectorizer.h (vectorizable_condition): Add argument.
* tree-vectorizer.h (vectorizable_condition): Add argument.
        * tree-vect-loop.c (vectorizable_reduction): Fail for condition
        in SLP.  Update calls to vectorizable_condition.
        * tree-vect-stmts.c (vect_is_simple_cond): Add basic block info
        to the arguments.  Pass it to vect_is_simple_use_1.
        (vectorizable_condition): Add slp_node to the arguments.
        Support vectorization of basic blocks.  Fail for reduction in
        SLP.  Update calls to vect_is_simple_cond and
        vect_is_simple_use.  Support SLP: call vect_get_slp_defs to get
        vector operands.
        (vect_analyze_stmt): Update calls to vectorizable_condition.
        (vect_transform_stmt): Likewise.
        * tree-vect-slp.c (vect_create_new_slp_node): Handle COND_EXPR.
        (vect_get_and_check_slp_defs): Handle COND_EXPR.  Allow pattern
        def stmts.
        (vect_build_slp_tree): Handle COND_EXPR.
        (vect_analyze_slp_instance): Push pattern statements to root
        node.
        (vect_get_constant_vectors): Fix comments.  Handle COND_EXPR.

From-SVN: r181026
2011-11-06 09:01:45 +00:00
Ira Rosen d092494cf3 re PR tree-optimization/50912 (gimple assertion failure at gimple.h:1940 with -msse2)
PR tree-optimization/50912
	* tree-vectorizer.h (slp_void_p): New.
	(struct _slp_tree): Replace left and right with children.  Update
	documentation.
	(struct _slp_oprnd_info): New.
	(vect_get_vec_defs): Declare.
	(vect_get_slp_defs): Update arguments.
	* tree-vect-loop.c (vect_create_epilog_for_reduction): Call
	vect_get_vec_defs instead of vect_get_slp_defs.
	(vectorizable_reduction): Likewise.
	* tree-vect-stmts.c (vect_get_vec_defs): Remove static, add argument.
	Update call to vect_get_slp_defs.
	(vectorizable_conversion): Update call to vect_get_vec_defs.
	(vectorizable_assignment, vectorizable_shift,
	vectorizable_operation): Likewise.
	(vectorizable_type_demotion): Call vect_get_vec_defs instead of
	vect_get_slp_defs.
	(vectorizable_type_promotion, vectorizable_store): Likewise.
	(vect_analyze_stmt): Fix typo.
	* tree-vect-slp.c (vect_free_slp_tree): Update SLP tree traversal.
	(vect_print_slp_tree, vect_mark_slp_stmts,
	vect_mark_slp_stmts_relevant, vect_slp_rearrange_stmts,
	vect_detect_hybrid_slp_stmts, vect_slp_analyze_node_operations,
	vect_schedule_slp_instance): Likewise.
	(vect_create_new_slp_node): New.
	(vect_create_oprnd_info, vect_free_oprnd_info): Likewise.
	(vect_get_and_check_slp_defs): Pass information about defs using
	oprnds_info, allow any number of operands.
	(vect_build_slp_tree): Likewise.  Update calls to
	vect_get_and_check_slp_defs.  Fix comments.
	(vect_analyze_slp_instance): Move node creation to
	vect_create_new_slp_node.
	(vect_get_slp_defs): Allow any number of operands.

From-SVN: r180819
2011-11-03 08:44:35 +00:00
Richard Guenther 7b7b1813da tree-vect-stmts.c (vect_get_vec_def_for_operand): Convert constants to vector element type.
2011-10-24  Richard Guenther  <rguenther@suse.de>

	* tree-vect-stmts.c (vect_get_vec_def_for_operand): Convert constants
	to vector element type.
	(vectorizable_assignment): Bail out for non-mode-precision operations.
	(vectorizable_shift): Likewise.
	(vectorizable_operation): Likewise.
	(vectorizable_type_demotion): Likewise.
	(vectorizable_type_promotion): Likewise.
	(vectorizable_store): Handle non-mode-precision stores.
	(vectorizable_load): Handle non-mode-precision loads.
	(get_vectype_for_scalar_type_and_size): Return a vector type
	for non-mode-precision integers.
	* tree-vect-loop.c (vectorizable_reduction): Bail out for
	non-mode-precision reductions.

	* gcc.dg/vect/vect-bool-1.c: New testcase.

From-SVN: r180384
2011-10-24 14:24:36 +00:00
Ira Rosen 5bfdb7d889 re PR tree-optimization/50819 (missed SLP vectorization)
PR tree-optimization/50819
        * tree-vectorizer.h (vect_analyze_data_ref_dependences): Remove
        the last argument.
        * tree-vect-loop.c (vect_analyze_loop_2): Update call to
        vect_analyze_data_ref_dependences.
        * tree-vect-data-refs.c (vect_analyze_data_ref_dependence):
        Remove the last argument.  Check load-after-store dependence
        for unknown dependencies in basic blocks.
        (vect_analyze_data_ref_dependences): Update call to
        vect_analyze_data_ref_dependences.
        * tree-vect-patterns.c (vect_recog_widen_shift_pattern): Fix
        typo.
        * tree-vect-slp.c (vect_bb_vectorizable_with_dependencies):
        Remove.
        (vect_slp_analyze_bb_1): Update call to
        vect_analyze_data_ref_dependences.  Don't call
        vect_bb_vectorizable_with_dependencies.

From-SVN: r180334
2011-10-23 12:13:49 +00:00
Richard Guenther 107defbe86 re PR tree-optimization/50328 (reduction with constant or invariant not vectorized)
2011-09-09  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/50328
	* tree-vect-loop.c (vect_is_simple_reduction_1): Allow one
	constant or default-def operand.

	* gcc.dg/vect/fast-math-vect-outer-7.c: New testcase.

From-SVN: r178728
2011-09-09 12:35:11 +00:00
Richard Guenther 4e71066d7e expr.c (expand_expr_real_2): Move COND_EXPR and VEC_COND_EXPR handling here, from ...
2011-08-31  Richard Guenther  <rguenther@suse.de>

	* expr.c (expand_expr_real_2): Move COND_EXPR and VEC_COND_EXPR
	handling here, from ...
	(expand_expr_real_1): ... here.
	* gimple-pretty-print.c (dump_ternary_rhs): Handle COND_EXPR
	and VEC_COND_EXPR.
	* gimple.c (gimple_rhs_class_table): Make COND_EXPR and VEC_COND_EXPR
	a GIMPLE_TERNARY_RHS.
	* tree-cfg.c (verify_gimple_assign_ternary): Handle COND_EXPR
	and VEC_COND_EXPR here ...
	(verify_gimple_assign_single): ... not here.
	* gimple-fold.c (fold_gimple_assign): Move COND_EXPR folding.
	* tree-object-size.c (cond_expr_object_size): Adjust.
	(collect_object_sizes_for): Likewise.
	* tree-scalar-evolution.c (interpret_expr): Don't handle
	ternary RHSs.
	* tree-ssa-forwprop.c (forward_propagate_into_cond): Fix and
	simplify.
	(ssa_forward_propagate_and_combine): Adjust.
	* tree-ssa-loop-im.c (move_computations_stmt): Build the COND_EXPR
	as ternary.
	* tree-ssa-threadedge.c (fold_assignment_stmt): Adjust.
	* tree-vect-loop.c (vect_is_simple_reduction_1): Likewise.
	* tree-vect-stmt.c (vectorizable_condition): Likewise.
	* tree-vrp.c (extract_range_from_cond_expr): Likewise.
	(extract_range_from_assignment): Likewise.

From-SVN: r178408
2011-09-01 11:46:08 +00:00
Ira Rosen 1684ca6b9b re PR tree-optimization/50014 (Assertion failed in vect_get_vec_def_for_stmt_copy)
PR tree-optimization/50014
        * tree-vect-loop.c (vectorizable_reduction): Get def type before
        calling vect_get_vec_def_for_stmt_copy ().

From-SVN: r177581
2011-08-09 06:02:00 +00:00
Ira Rosen 2aacf3c3fc tree-vect-loop.c (vect_create_epilog_for_reduction): Use the result of multiple results reduction when...
* tree-vect-loop.c (vect_create_epilog_for_reduction): Use the
        result of multiple results reduction when extracting the final
        value using scalar code.

From-SVN: r177426
2011-08-05 11:12:28 +00:00
Ira Rosen 1107f3ae0a tree-vectorizer.h (struct _stmt_vec_info): Add new field for pattern def statement, and its access macro.
* tree-vectorizer.h (struct _stmt_vec_info): Add new field for
        pattern def statement, and its access macro.
        (NUM_PATTERNS): Set to 5.
        * tree-vect-loop.c (vect_determine_vectorization_factor): Handle
        pattern def statement.
        (vect_transform_loop): Likewise.
        * tree-vect-patterns.c (vect_vect_recog_func_ptrs): Add new
        function vect_recog_over_widening_pattern ().
        (vect_operation_fits_smaller_type): New function.
        (vect_recog_over_widening_pattern, vect_mark_pattern_stmts):
        Likewise.
        (vect_pattern_recog_1): Move the code that marks pattern
        statements to vect_mark_pattern_stmts (), and call it.  Update
        documentation.
        * tree-vect-stmts.c (vect_supportable_shift): New function.
        (vect_analyze_stmt): Handle pattern def statement.
        (new_stmt_vec_info): Initialize pattern def statement.

From-SVN: r177409
2011-08-04 16:47:17 +00:00
Ira Rosen 67f2d54f56 re PR tree-optimization/49926 (ice in process_use, at tree-vect-stmts.c:405)
PR tree-optimization/49926
        * tree-vect-loop.c (vect_is_slp_reduction): Check that a
        statement in a chain doesn't have uses both inside and
        outside the loop.

From-SVN: r177063
2011-08-01 16:58:20 +00:00
Ira Rosen b5066d8b10 re PR tree-optimization/49610 (Segfault with -ftree-vectorize (or -O3))
PR tree-optimization/49610
        * tree-vect-loop.c (vect_is_slp_reduction): Check that DEF_STMT has
        a basic block.

From-SVN: r175786
2011-07-03 10:14:55 +00:00
Ira Rosen 83197f3733 tree-vect-loop.c (vect_determine_vectorization_factor): Handle both pattern and original statements if necessary.
* tree-vect-loop.c (vect_determine_vectorization_factor): Handle
        both pattern and original statements if necessary.
        (vect_transform_loop): Likewise.
        * tree-vect-patterns.c (vect_pattern_recog): Update documentation.
        * tree-vect-stmts.c (vect_mark_relevant): Add new argument.
        Mark the pattern statement only if the original statement doesn't
        have its own uses.
        (process_use): Call vect_mark_relevant with additional parameter.
        (vect_mark_stmts_to_be_vectorized): Likewise.
        (vect_get_vec_def_for_operand): Use vectorized pattern statement.
        (vect_analyze_stmt): Handle both pattern and original statements
        if necessary.
        (vect_transform_stmt): Don't store vectorized pattern statement
        in the original statement.
        (vect_is_simple_use_1): Use related pattern statement only if the
        original statement is irrelevant.
        * tree-vect-slp.c (vect_get_and_check_slp_defs): Likewise.

From-SVN: r175681
2011-06-30 06:37:41 +00:00
Ira Rosen 5181cd6a44 re PR tree-optimization/49478 (ice in expand_widen_pattern_expr with -O3)
PR tree-optimization/49478
        * tree-vect-loop.c (vectorizable_reduction): Handle DOT_PROD_EXPR
        with constant operand.

From-SVN: r175255
2011-06-21 11:58:33 +00:00
Ira Rosen 5131223306 tree-vectorizer.h (vect_recog_func_ptr): Change the first argument to be a VEC of statements.
* tree-vectorizer.h (vect_recog_func_ptr): Change the first
        argument to be a VEC of statements.
        * tree-vect-loop.c (vect_determine_vectorization_factor):
        Remove the assert that pattern statements have to have their
        vector type set.
        * tree-vect-patterns.c (vect_recog_widen_sum_pattern):
        Change the first argument to be a VEC of statements.  Update
        documentation.
        (vect_recog_dot_prod_pattern, vect_recog_pow_pattern): Likewise.
        (vect_handle_widen_mult_by_const): New function.
        (vect_recog_widen_mult_pattern):  Change the first argument to
        be a VEC of statements.  Update documentation.  Check that the
        constant is INTEGER_CST.  Support multiplication by a constant
        that fits an intermediate type - call
        vect_handle_widen_mult_by_const.
        (vect_pattern_recog_1): Update vect_recog_func_ptr and its
        call.  Handle additional pattern statements if necessary.

From-SVN: r175102
2011-06-16 12:08:37 +00:00
Ira Rosen 9d5e7640c3 tree-vect-loop-manip.c (remove_dead_stmts_from_loop): Remove.
* tree-vect-loop-manip.c (remove_dead_stmts_from_loop): Remove.
        (slpeel_tree_peel_loop_to_edge): Don't call
        remove_dead_stmts_from_loop.
        * tree-vect-loop.c (vect_determine_vectorization_factor): Don't
        remove irrelevant pattern statements.  For irrelevant statements
        check if it is the last statement of a detected pattern, use
        corresponding pattern statement instead.
        (destroy_loop_vec_info): No need to remove pattern statements,
        only free stmt_vec_info.
        (vect_transform_loop): For irrelevant statements check if it is
        the last statement of a detected pattern, use corresponding
        pattern statement instead.
        * tree-vect-patterns.c (vect_pattern_recog_1): Don't insert
        pattern statements.  Set basic block for the new statement.
        (vect_pattern_recog): Update documentation.
        * tree-vect-stmts.c (vect_mark_stmts_to_be_vectorized): Scan
        operands of pattern statements.
        (vectorizable_call): Fix printing.  In case of a pattern
        statement use the lhs of the original statement when creating
        a dummy statement to replace the original call.
        (vect_analyze_stmt): For irrelevant statements check if it is
        the last statement of a detected pattern, use corresponding
        pattern statement instead.
        * tree-vect-slp.c (vect_schedule_slp_instance): For pattern
        statements use gsi of the original statement.

From-SVN: r175074
2011-06-15 06:27:32 +00:00
Jakub Jelinek 29f8523742 re PR tree-optimization/49352 (-fcompare-debug failure with -O2 -ftree-vectorize)
PR tree-optimization/49352
        * tree-vect-loop.c (vect_is_slp_reduction): Don't count debug
        uses at all, make sure loop_use_stmt after the loop is a def
        stmt of a used SSA_NAME that is the only one defined inside
        of the loop.  Don't check for COND_EXPR and GIMPLE_BINARY_RHS.
        (vect_is_simple_reduction_1): Call vect_is_slp_reduction only
        if check_reduction is true.


Co-Authored-By: Ira Rosen <ira.rosen@linaro.org>

From-SVN: r174982
2011-06-13 06:10:20 +00:00
Ira Rosen f2164f876f re PR tree-optimization/49318 (177.mesa in SPEC CPU 2000 failed to build)
PR tree-optimization/49318
        * tree-vect-loop.c (vect_determine_vectorization_factor):
        Remove irrelevant pattern statements.

From-SVN: r174891
2011-06-10 07:19:28 +00:00
Ira Rosen 69940d4d9e re PR tree-optimization/49199 (ICE: in vect_create_epilog_for_reduction at tree-vect-loop.c:3445 with -O -fno-tree-scev-cprop -ftree-vectorize -funswitch-loops)
PR tree-optimization/49199
        * tree-vect-loop.c (vect_is_slp_reduction): Check that the 
        non-reduction operands are either defined in the loop or
        by induction.

From-SVN: r174425
2011-05-30 07:15:31 +00:00
Ira Rosen 48df3fa66c re PR tree-optimization/49038 (-ftree-vectorise introduces reads past end of array)
PR tree-optimization/49038
        * tree-vect-loop-manip.c (vect_generate_tmps_on_preheader):
        Ensure at least one epilogue iteration if required by data
        accesses with gaps.
        * tree-vectorizer.h (struct _loop_vec_info): Add new field 
        to mark loops that require peeling for gaps.
        * tree-vect-loop.c (new_loop_vec_info): Initialize new field.
        (vect_get_known_peeling_cost): Take peeling for gaps into 
        account.
        (vect_transform_loop): Generate epilogue if required by data
        access with gaps.
        * tree-vect-data-refs.c (vect_analyze_group_access): Mark the
        loop as requiring an epilogue if there are gaps in the end of
        the strided group.

From-SVN: r174265
2011-05-26 07:50:09 +00:00
Ira Rosen e38fdc948a re PR tree-optimization/49087 (crash in vect_is_slp_reduction)
PR tree-optimization/49087
        * tree-vect-loop.c (vect_is_slp_reduction): Fail if
        LHS has no uses.

From-SVN: r174026
2011-05-22 08:04:43 +00:00
Ira Rosen b010117a6c re PR tree-optimization/41881 (Complete unrolling (inner) versus vectorization of reduction)
PR tree-optimization/41881
        * tree-vectorizer.h (struct _loop_vec_info): Add new field
        reduction_chains along with a macro for its access.
        * tree-vect-loop.c (new_loop_vec_info): Initialize
        reduction chains.
        (destroy_loop_vec_info): Free reduction chains.
        (vect_analyze_loop_2): Return false if
        vect_analyze_slp() returns false.
        (vect_is_slp_reduction): New function.
        (vect_is_simple_reduction_1): Call
        vect_is_slp_reduction.
        (vect_create_epilog_for_reduction): Support SLP
        reduction chains.
        * tree-vect-slp.c (vect_get_and_check_slp_defs): Allow
        different definition types for reduction chains.
        (vect_supported_load_permutation_p): Don't allow
        permutations for reduction chains.
        (vect_analyze_slp_instance): Support reduction chains.
        (vect_analyze_slp): Try to build SLP instance from
        reduction chains.
        (vect_get_constant_vectors):  Handle reduction chains.
        (vect_schedule_slp_instance): Mark the first statement
        of the reduction chain as reduction.

From-SVN: r173856
2011-05-18 11:27:51 +00:00
Ira Rosen e14c105000 tree-vect-loop-manip.c (vect_create_cond_for_alias_checks): Use new names for group elements access.
* tree-vect-loop-manip.c (vect_create_cond_for_alias_checks): Use new
        names for group elements access.
        * tree-vectorizer.h (struct _stmt_vec_info): Use interleaving info for
        reduction chains as well.  Remove data reference and interleaving
        related words from the fields names.
        * tree-vect-loop.c (vect_transform_loop): Use new names for group
        elements access.
        * tree-vect-data-refs.c (vect_get_place_in_interleaving_chain,
         vect_insert_into_interleaving_chain, vect_update_interleaving_chain,
        vect_update_interleaving_chain, vect_same_range_drs,
        vect_analyze_data_ref_dependence, vect_update_misalignment_for_peel,
        vect_verify_datarefs_alignment, vector_alignment_reachable_p,
        vect_peeling_hash_get_lowest_cost, vect_enhance_data_refs_alignment,
        vect_analyze_group_access, vect_analyze_data_ref_access,
        vect_create_data_ref_ptr, vect_transform_strided_load,
        vect_record_strided_load_vectors): Likewise.
        * tree-vect-stmts.c (vect_model_simple_cost, vect_model_store_cost,
        vect_model_load_cost, vectorizable_store, vectorizable_load,
        vect_remove_stores, new_stmt_vec_info): Likewise.
        * tree-vect-slp.c (vect_build_slp_tree, 
        vect_supported_slp_permutation_p, vect_analyze_slp_instance): Likewise.

From-SVN: r173855
2011-05-18 11:09:44 +00:00