Commit Graph

39 Commits

Author SHA1 Message Date
Jan Hubicka efd8f7507b loop-unswitch.c (unswitch_single_loop): Use optimize_loop_for_speed_p.
* loop-unswitch.c (unswitch_single_loop): Use optimize_loop_for_speed_p.
	* tree-ssa-threadupdate.c (mark_threaded_blocks): Use optimize_function_for_size_p.
	* tracer.c (ignore_bb_p): Use optimize_bb_for_size_p.
	* postreload-gcse.c (eliminate_partially_redundant_load): Use optimize_bb_for_size_p.
	* value-prof.c (gimple_divmod_fixed_value_transform,
	gimple_mod_pow2_value_transform, gimple_mod_subtract_transform,
	gimple_stringops_transform): Use optimize_bb_for_size_p.
	* ipa-cp.c (ipcp_insert_stage): Use optimize_function_for_size_p.
	* final.c (compute_alignments): Use optimize_function_for_size_p.
	* builtins.c (fold_builtin_cabs): Use optimize_function_for_speed_p.
	(fold_builtin_strcpy, fold_builtin_fputs): Use
	optimize_function_for_size_p.
	* fold-const.c (tree_swap_operands_p): Use optimize_function_for_size_p.
	* recog.c (relax_delay_slots): Likewise.
	* tree-ssa-math-opts.c (replace_reciprocal): Use optimize_bb_for_speed_p.
	(execute_cse_reciprocals): Use optimize_bb_for_size_p.
	* ipa-inline.c (cgraph_decide_recursive_inlining): Use
	optimize_function_for_size_p.
	(cgraph_decide_inlining_of_small_function): Use
	optimize_function_for_size_p.
	* global.c (find_reg): Use optimize_function_for_size_p.
	* opts.c (decode_options): Do not clear flag_tree_ch, flag_inline_functions,
	flag_unswitch_loops, flag_unroll_loops, flag_unroll_all_loops and
	flag_prefetch_loop_arrays. Those can work it out from profile.
	* tree-ssa-loop-ivcanon.c (tree_unroll_loops_completely): Use
	optimize_loop_for_speed_p.
	* predict.c (optimize_bb_for_size_p, optimize_bb_for_speed_p): Constify
	argument.
	(optimize_loop_nest_for_size_p, optimize_loop_nest_for_speed_p): New.
	* tree-parloops.c (parallelize_loops): Use optimize_loop_for_size_p.
	* tree-eh.c (decide_copy_try_finally): Use optimize_function_for_size_p.
	* local-alloc.c (block_alloc): Pass BB pointer.
	(find_free_reg): Add BB pointer, use optimize_bb_for_size_p.
	* gcse.c (gcse_main): Use optimize_function_for_size_p.
	* loop-unroll.c (decide_unrolling_and_peeling): Use optimize_loop_for_size_p.
	(decide_peel_completely): Likewise.
	* tree-vect-analyze.c (vect_mark_for_runtime_alias_test): Use
	optimize_loop_for_size_p.
	(vect_enhance_data_refs_alignment): Likewise.
	* tree-ssa-coalesce.c (coalesce_cost): Add optimize_for_size argument.
	(coalesce_cost_bb, coalesce_cost_edge, create_outofssa_var_map): Update call.
	* cfgcleanup.c (outgoing_edges_match): Use optimize_bb_for_speed_p.
	(try_crossjump_bb): Use optimize_bb_for_size_p.
	* tree-ssa-loop-prefetch.c (loop_prefetch_arrays): Use
	optimize_loop_for_speed_p.
	* bb-reorder.c (find_traces_1_round): Likewise.
	(copy_bb): Use optimize_bb_for_speed_p.
	(duplicate_computed_gotos): Likewise.
	* basic-block.h (optimize_loop_nest_for_size_p,
	optimize_loop_nest_for_speed_p): New.
	* stmt.c (expand_case): Use optimize_insn_for_size_p.

From-SVN: r139760
2008-08-29 10:35:57 +00:00
Richard Guenther 678e7c6504 tree-ssa-pre.c (fini_pre): Take in_fre parameter.
2008-08-01  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-pre.c (fini_pre): Take in_fre parameter.  Free
	loop information only if we initialized it.
	(execute_pre): Call fini_pre with in_fre.
	* tree-ssa-loop-ivcanon (try_unroll_loop_completely): Dump
	if we do not unroll because we hit max-completely-peeled-insns.
	Use our estimation for consistency, do allow shrinking.

From-SVN: r138522
2008-08-01 14:42:42 +00:00
Richard Biener 726a989a8b backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch.
2008-07-28  Richard Guenther  <rguenther@suse.de>

	Merge from gimple-tuples-branch.

	* ChangeLog.tuples: ChangeLog from gimple-tuples-branch.
	* gimple.def: New file.
	* gsstruct.def: Likewise.
	* gimple-iterator.c: Likewise.
	* gimple-pretty-print.c: Likewise.
	* tree-gimple.c: Removed.  Merged into ...
	* gimple.c: ... here.  New file.
	* tree-gimple.h: Removed.  Merged into ...
	* gimple.h: ... here.  New file.

	* Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h.
	* configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the
	--enable-checking=gimple flag.
	* config.in: Likewise.
	* configure: Regenerated.

	* tree-ssa-operands.h: Tuplified.
	* tree-vrp.c: Likewise.
	* tree-loop-linear.c: Likewise.
	* tree-into-ssa.c: Likewise.
	* tree-ssa-loop-im.c: Likewise.
	* tree-dump.c: Likewise.
	* tree-complex.c: Likewise.
	* cgraphbuild.c: Likewise.
	* tree-ssa-threadupdate.c: Likewise.
	* tree-ssa-loop-niter.c: Likewise.
	* tree-pretty-print.c: Likewise.
	* tracer.c: Likewise.
	* gengtype.c: Likewise.
	* tree-loop-distribution.c: Likewise.
	* tree-ssa-loop-unswitch.c: Likewise.
	* cgraph.c: Likewise.
	* cgraph.h: Likewise.
	* tree-ssa-loop-manip.c: Likewise.
	* value-prof.c: Likewise.
	* tree-ssa-loop-ch.c: Likewise.
	* tree-tailcall.c: Likewise.
	* value-prof.h: Likewise.
	* tree.c: Likewise.
	* tree.h: Likewise.
	* tree-pass.h: Likewise.
	* ipa-cp.c: Likewise.
	* tree-scalar-evolution.c: Likewise.
	* tree-scalar-evolution.h: Likewise.
	* target.h: Likewise.
	* lambda-mat.c: Likewise.
	* tree-phinodes.c: Likewise.
	* diagnostic.h: Likewise.
	* builtins.c: Likewise.
	* tree-ssa-alias-warnings.c: Likewise.
	* cfghooks.c: Likewise.
	* fold-const.c: Likewise.
	* cfghooks.h: Likewise.
	* omp-low.c: Likewise.
	* tree-ssa-dse.c: Likewise.
	* ipa-reference.c: Likewise.
	* tree-ssa-uncprop.c: Likewise.
	* toplev.c: Likewise.
	* tree-gimple.c: Likewise.
	* tree-gimple.h: Likewise.
	* tree-chrec.c: Likewise.
	* tree-chrec.h: Likewise.
	* tree-ssa-sccvn.c: Likewise.
	* tree-ssa-sccvn.h: Likewise.
	* cgraphunit.c: Likewise.
	* tree-ssa-copyrename.c: Likewise.
	* tree-ssa-ccp.c: Likewise.
	* tree-ssa-loop-ivopts.c: Likewise.
	* tree-nomudflap.c: Likewise.
	* tree-call-cdce.c: Likewise.
	* ipa-pure-const.c: Likewise.
	* c-format.c: Likewise.
	* tree-stdarg.c: Likewise.
	* tree-ssa-math-opts.c: Likewise.
	* tree-ssa-dom.c: Likewise.
	* tree-nrv.c: Likewise.
	* tree-ssa-propagate.c: Likewise.
	* ipa-utils.c: Likewise.
	* tree-ssa-propagate.h: Likewise.
	* tree-ssa-alias.c: Likewise.
	* gimple-low.c: Likewise.
	* tree-ssa-sink.c: Likewise.
	* ipa-inline.c: Likewise.
	* c-semantics.c: Likewise.
	* dwarf2out.c: Likewise.
	* expr.c: Likewise.
	* tree-ssa-loop-ivcanon.c: Likewise.
	* predict.c: Likewise.
	* tree-ssa-loop.c: Likewise.
	* tree-parloops.c: Likewise.
	* tree-ssa-address.c: Likewise.
	* tree-ssa-ifcombine.c: Likewise.
	* matrix-reorg.c: Likewise.
	* c-decl.c: Likewise.
	* tree-eh.c: Likewise.
	* c-pretty-print.c: Likewise.
	* lambda-trans.c: Likewise.
	* function.c: Likewise.
	* langhooks.c: Likewise.
	* ebitmap.h: Likewise.
	* tree-vectorizer.c: Likewise.
	* function.h: Likewise.
	* langhooks.h: Likewise.
	* tree-vectorizer.h: Likewise.
	* ipa-type-escape.c: Likewise.
	* ipa-type-escape.h: Likewise.
	* domwalk.c: Likewise.
	* tree-if-conv.c: Likewise.
	* profile.c: Likewise.
	* domwalk.h: Likewise.
	* tree-data-ref.c: Likewise.
	* tree-data-ref.h: Likewise.
	* tree-flow-inline.h: Likewise.
	* tree-affine.c: Likewise.
	* tree-vect-analyze.c: Likewise.
	* c-typeck.c: Likewise.
	* gimplify.c: Likewise.
	* coretypes.h: Likewise.
	* tree-ssa-phiopt.c: Likewise.
	* calls.c: Likewise.
	* tree-ssa-coalesce.c: Likewise.
	* tree.def: Likewise.
	* tree-dfa.c: Likewise.
	* except.c: Likewise.
	* except.h: Likewise.
	* cfgexpand.c: Likewise.
	* tree-cfgcleanup.c: Likewise.
	* tree-ssa-pre.c: Likewise.
	* tree-ssa-live.c: Likewise.
	* tree-sra.c: Likewise.
	* tree-ssa-live.h: Likewise.
	* tree-predcom.c: Likewise.
	* lambda.h: Likewise.
	* tree-mudflap.c: Likewise.
	* ipa-prop.c: Likewise.
	* print-tree.c: Likewise.
	* tree-ssa-copy.c: Likewise.
	* ipa-prop.h: Likewise.
	* tree-ssa-forwprop.c: Likewise.
	* ggc-page.c: Likewise.
	* c-omp.c: Likewise.
	* tree-ssa-dce.c: Likewise.
	* tree-vect-patterns.c: Likewise.
	* tree-ssa-ter.c: Likewise.
	* tree-nested.c: Likewise.
	* tree-ssa.c: Likewise.
	* lambda-code.c: Likewise.
	* tree-ssa-loop-prefetch.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-inline.h: Likewise.
	* tree-iterator.c: Likewise.
	* tree-optimize.c: Likewise.
	* tree-ssa-phiprop.c: Likewise.
	* tree-vect-transform.c: Likewise.
	* tree-object-size.c: Likewise.
	* tree-outof-ssa.c: Likewise.
	* cfgloop.c: Likewise.
	* system.h: Likewise.
	* tree-profile.c: Likewise.
	* cfgloop.h: Likewise.
	* c-gimplify.c: Likewise.
	* c-common.c: Likewise.
	* tree-vect-generic.c: Likewise.
	* tree-flow.h: Likewise.
	* c-common.h: Likewise.
	* basic-block.h: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* tree-switch-conversion.c: Likewise.
	* tree-ssa-structalias.h: Likewise.
	* tree-cfg.c: Likewise.
	* passes.c: Likewise.
	* ipa-struct-reorg.c: Likewise.
	* ipa-struct-reorg.h: Likewise.
	* tree-ssa-reassoc.c: Likewise.
	* cfgrtl.c: Likewise.
	* varpool.c: Likewise.
	* stmt.c: Likewise.
	* tree-ssanames.c: Likewise.
	* tree-ssa-threadedge.c: Likewise.
	* langhooks-def.h: Likewise.
	* tree-ssa-operands.c: Likewise.
	* config/alpha/alpha.c: Likewise.
	* config/frv/frv.c: Likewise.
	* config/s390/s390.c: Likewise.
	* config/m32c/m32c.c: Likewise.
	* config/m32c/m32c-protos.h: Likewise.
	* config/spu/spu.c: Likewise.
	* config/sparc/sparc.c: Likewise.
	* config/i386/i386.c: Likewise.
	* config/sh/sh.c: Likewise.
	* config/xtensa/xtensa.c: Likewise.
	* config/stormy16/stormy16.c: Likewise.
	* config/ia64/ia64.c: Likewise.
	* config/rs6000/rs6000.c: Likewise.
	* config/pa/pa.c: Likewise.
	* config/mips/mips.c: Likewise.

From-SVN: r138207
2008-07-28 14:33:56 +00:00
Richard Guenther ace4eb9013 re PR tree-optimization/36078 (gfortran fails to build cpu2006/465.tonto)
2008-04-29  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/36078
	* tree-ssa-loop-ivcanon.c (tree_unroll_loops_completely):
	Update virtual SSA form after cleaning up the CFG.

	* gfortran.fortran-torture/compile/pr36078.f90: New testcase.

From-SVN: r134799
2008-04-29 16:01:36 +00:00
Richard Guenther d6e840eed2 re PR tree-optimization/18754 (unrolling happens too late/SRA does not happen late enough)
2008-04-27  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/18754
	PR tree-optimization/34223
	* tree-pass.h (pass_complete_unrolli): Declare.
	* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Print
	loop size before and after unconditionally of UL_NO_GROWTH in effect.
	Rewrite loop into loop closed SSA form if it is not already.
	(tree_unroll_loops_completely): Re-structure to iterate over
	innermost loops with intermediate CFG cleanups.
	Unroll outermost loops only if requested or the code does not grow
	doing so.
	* tree-ssa-loop.c (gate_tree_vectorize): Don't shortcut if no
	loops are available.
	(tree_vectorize): Instead do so here.
	(tree_complete_unroll): Also unroll outermost loops.
	(tree_complete_unroll_inner): New function.
	(gate_tree_complete_unroll_inner): Likewise.
	(pass_complete_unrolli): New pass.
	* tree-ssa-loop-manip.c (find_uses_to_rename_use): Only record
	uses outside of the loop.
	(tree_duplicate_loop_to_header_edge): Only verify loop-closed SSA
	form if it is available.  
	* tree-flow.h (tree_unroll_loops_completely): Add extra parameter.
	* passes.c (init_optimization_passes): Schedule complete inner
	loop unrolling pass before the first CCP pass after final inlining.

	* gcc.dg/tree-ssa/loop-36.c: New testcase.
	* gcc.dg/tree-ssa/loop-37.c: Likewise.
	* gcc.dg/vect/vect-118.c: Likewise.
	* gcc.dg/Wunreachable-8.c: XFAIL bogus warning.
	* gcc.dg/vect/vect-66.c: Increase loop trip count.
	* gcc.dg/vect/no-section-anchors-vect-66.c: Likewise.
	* gcc.dg/vect/no-section-anchors-vect-69.c: Likewise.
	* gcc.dg/vect/vect-76.c: Likewise.
	* gcc.dg/vect/vect-outer-6.c: Likewise.
	* gcc.dg/vect/vect-outer-1.c: Likewise.
	* gcc.dg/vect/vect-outer-1a.c: Likewise.
	* gcc.dg/vect/vect-11a.c: Likewise.
	* gcc.dg/vect/vect-shift-1.c: Likewise.
	* gcc.target/i386/vectorize1.c: Likewise.

From-SVN: r134730
2008-04-27 16:27:08 +00:00
Sebastian Pop 6c74788ed7 tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Remove unused edges after loop duplication.
2007-11-14  Sebastian Pop  <sebastian.pop@amd.com>

	* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Remove
	unused edges after loop duplication.

From-SVN: r130182
2007-11-14 17:36:01 +00:00
Nick Clifton 9dcd6f09a3 Change copyright header to refer to version 3 of the GNU General Public License and to point readers at the COPYING3 file and the FSF's license web page.
From-SVN: r126948
2007-07-26 08:37:01 +00:00
Zdenek Dvorak b44e7f07c5 re PR tree-optimization/23361 (Can't eliminate empty loops with power of two step and variable bounds)
2007-02-09  Zdenek Dvorak  <dvorakz@suse.cz>
	Richard Guenther  <rguenther@suse.de>

	PR middle-end/23361
	* fold-const.c (fold_comparison): Handle obfuscated comparisons
	against INT_MIN/INT_MAX.
	* tree-ssa-loop-ivcanon.c (remove_empty_loop): Print to dump
	file if a loop is removed.

	* gcc.dg/fold-compare-3.c: New testcase.
	* gcc.dg/tree-ssa/loop-24.c: Likewise.

Co-Authored-By: Richard Guenther <rguenther@suse.de>

From-SVN: r121742
2007-02-09 13:29:11 +00:00
Zdenek Dvorak 7f9bc51b09 tree-ssa-loop-unswitch.c: Include tree-inline.h.
* tree-ssa-loop-unswitch.c: Include tree-inline.h.
	(tree_unswitch_single_loop): Pass eni_size_weights to
	tree_num_loop_insns.
	* tree-ssa-loop-manip.c: Include tree-inline.h.
	(can_unroll_loop_p): Pass eni_size_weights to
	tree_num_loop_insns.
	* tree-ssa-loop-ch.c (should_duplicate_loop_header_p):
	Pass eni_size_weights to estimate_num_insns.
	* tree.h (init_inline_once): Export.
	* toplev.c (backend_init): Call init_inline_once.
	* cgraphunit.c (cgraph_process_new_functions,
	cgraph_analyze_function): Pass eni_inlining_weights to
	estimate_num_insns.
	* ipa-inline.c (compute_inline_parameters): Ditto.
	* tree-ssa-loop-ivcanon.c (tree_num_loop_insns): Pass weights
	to estimate_num_insns.
	(try_unroll_loop_completely): Pass eni_size_weights to
	tree_num_loop_insns.
	* tree-eh.c (decide_copy_try_finally): Pass eni_size_weights
	ot estimate_num_insns.
	* tree-ssa-loop-prefetch.c: Include tree-inline.h.
	(loop_prefetch_arrays): Pass eni_time_weights to tree_num_loop_insns.
	* tree-inline.c (eni_inlining_weights, eni_size_weights,
	eni_time_weights): New variables.
	(init_inline_once): Initialize them.
	(struct eni_data): Mew.
	(estimate_num_insns_1, estimate_num_insns): Use weights.
	* tree-inline.h (struct eni_weights_d): New.
	(eni_inlining_weights, eni_size_weights, eni_time_weights): Declare.
	(estimate_num_insns): Declaration changed.
	* cfgloop.h (tree_num_loop_insns): Declaration changed.
	* Makefile.in (tree-ssa-loop-unswitch.o, tree-ssa-loop-prefetch.o,
	tree-ssa-loop-manip.o): Add TREE_INLINE_H dependency.

	* gcc.dg/tree-ssa/loop-23.c: New test.

From-SVN: r121260
2007-01-28 17:40:38 +00:00
Zdenek Dvorak ee8c1b05d5 loop-unswitch.c (unswitch_loop): Update arguments of duplicate_loop_to_header_edge call.
* loop-unswitch.c (unswitch_loop): Update arguments of
	duplicate_loop_to_header_edge call.
	* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Ditto.
	* loop-unroll.c (peel_loop_completely, unroll_loop_constant_iterations,
	unroll_loop_runtime_iterations, peel_loop_simple, unroll_loop_stupid):
	Ditto.
	* cfgloopmanip.c (loop_version): Ditto.
	(duplicate_loop_to_header_edge): Change
	type of to_remove to VEC(edge), remove n_to_remove argument.
	* tree-ssa-loop-manip.c (tree_duplicate_loop_to_header_edge):
	Change type of to_remove to VEC(edge), remove n_to_remove argument.
	(tree_unroll_loop): Update arguments of
	tree_duplicate_loop_to_header_edge call.
	* cfghooks.c (cfg_hook_duplicate_loop_to_header_edge):
	Change type of to_remove to VEC(edge), remove n_to_remove argument.
	* cfghooks.h (struct cfg_hooks): Type of
	cfg_hook_duplicate_loop_to_header_edge changed.
	(cfg_hook_duplicate_loop_to_header_edge): Declaration changed.
	* cfgloop.h (duplicate_loop_to_header_edge): Ditto.
	* tree-flow.h (tree_duplicate_loop_to_header_edge): Ditto.

From-SVN: r120074
2006-12-20 14:15:53 +00:00
Zdenek Dvorak a14865dbe0 loop.texi: Document number_of_latch_executions and number_of_cond_exit_executions.
* doc/loop.texi: Document number_of_latch_executions and
	number_of_cond_exit_executions.
	* tree-scalar-evolution.c (compute_overall_effect_of_inner_loop,
	chrec_is_positive, number_of_iterations_for_all_loops,
	scev_const_prop): Use number_of_latch_executions.
	(set_nb_iterations_in_loop): Do not increase the value of the
	number of iterations.
	(number_of_iterations_in_loop): Renamed to ...
	(number_of_latch_executions): ... this.
	(number_of_exit_cond_executions): New function.
	* tree-scalar-evolution.h (number_of_iterations_in_loop): Declaration
	removed.
	(number_of_latch_executions, number_of_exit_cond_executions): Declare.
	* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables): Use
	number_of_latch_executions.
	* tree-data-ref.c (get_number_of_iters_for_loop): Use
	number_of_exit_cond_executions.
	* tree-vect-analyze.c (vect_get_loop_niters): Ditto.
	* cfgloop.h (struct loop): Improve description of the nb_iterations
	field.

	* gcc.dg/tree-ssa/loop-17.c: Update outcome.

From-SVN: r119718
2006-12-10 23:34:20 +00:00
Zdenek Dvorak 42fd6772c6 tree-vrp.c (adjust_range_with_scev): Use get_chrec_loop.
* tree-vrp.c (adjust_range_with_scev): Use get_chrec_loop.
	* loop-unswitch.c (unswitch_loops): Use FOR_EACH_LOOP.
	* tree-loop-linear.c (linear_transform_loops): Ditto.
	* tree-ssa-loop-im.c (determine_lsm): Ditto.
	* tree-ssa-loop-niter.c (estimate_numbers_of_iterations,
	free_numbers_of_iterations_estimates): Ditto.
	* tree_ssa_unswitch_loops (tree_ssa_unswitch_loops): Ditto.
	* tree-ssa-loop-ch.c (copy_loop_headers): Ditto.
	* tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize): Ditto.
	* modulo-sched.c (sms_schedule): Ditto.
	* tree-ssa-loop-ivcanon.c (canonicalize_induction_variables,
	tree_unroll_loops_completely): Ditto.
	* predict.c (predict_loops): Ditto.
	* tree-if-conv.c (main_tree_if_conversion): Ditto.
	* loop-unroll.c (unroll_and_peel_loops, peel_loops_completely,
	decide_unrolling_and_peeling): Ditto.
	* cfgloopmanip.c (unloop): Use delete_loop.
	(place_new_loop): Access larray vector instead of parray.
	(create_preheaders, force_single_succ_latches,
	fix_loop_structure): Use FOR_EACH_LOOP and delete_loop..
	* loop-doloop.c (doloop_optimize_loops): Ditto.
	* loop-invariant.c (move_loop_invariants): Ditto.
	* tree-cfg.c (replace_uses_by): Ditto.
	* tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Ditto.
	* tree-chrec.h (CHREC_VAR, CHREC_LEFT, CHREC_RIGHT, CHREC_VARIABLE):
	Moved to ...
	* tree.h (CHREC_VAR, CHREC_LEFT, CHREC_RIGHT, CHREC_VARIABLE):
	... here.
	* tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop,
	compute_overall_effect_of_inner_loop, chrec_is_positive): Use
	get_loop and get_chrec_loop.
	(number_of_iterations_for_all_loops): Use number_of_loops.
	(scev_initialize, scev_reset, scev_const_prop): Use FOR_EACH_LOOP.
	* tree-scalar-evolution.h (get_chrec_loop): New inline function.
	* cfgloopanal.c (mark_irreducible_loops): Use number_of_loops,
	and FOR_EACH_LOOP.
	* tree-chrec.c (evolution_function_is_invariant_rec_p,
	chrec_convert_1): Use get_loop and get_chrec_loop.
	* loop-init.c (loop_optimizer_init): Use number_of_loops.
	(loop_optimizer_init): Use FOR_EACH_LOOP.
	* tree-vectorizer.c (vect_loops_num): Removed.
	(vectorize_loops): Store number of loops locally.  Use
	FOR_EACH_LOOP and get_loop.
	* tree-vectorizer.h (vect_loops_num): Removed.
	* tree-data-ref.c (get_number_of_iters_for_loop): Use get_loop.
	(find_data_references_in_loop): Do not set parallel_p.
	* tree-data-ref.h: Do not declare VEC(loop_p).
	* cfgloop.c (flow_loops_dump, mark_single_exit_loops,
	verify_loop_structure): Use FOR_EACH_LOOP.
	(flow_loops_free): Use FOR_EACH_LOOP, free larray vector.
	(initialize_loops_parallel_p): Removed.
	(flow_loops_find): Push the loops into a vector.
	(delete_loop): New function.
	(cancel_loop): Use delete_loop.
	* cfgloop.h: Declare VEC(loop_p).
	(struct loop): Remove parallel_p field.
	(struct loops): Replace num and parray field by larray vector.
	Remove shared_headers field.
	(delete_loop): Declare.
	(get_loop, get_loops, number_of_loops, fel_next, fel_init,
	FOR_EACH_LOOP): New.
	* doc/loop.tex: Document new accessor functions.

From-SVN: r119713
2006-12-10 22:17:15 +00:00
Aldy Hernandez 07beea0df3 Merge gimple-tuples-branch into mainline.
From-SVN: r119546
2006-12-05 17:26:05 +00:00
Zdenek Dvorak d73be2683d tree-vrp.c (execute_vrp): Do not pass loops structure through arguments.
* tree-vrp.c (execute_vrp): Do not pass loops structure through
	arguments.
	* loop-unswitch.c (unswitch_loops, unswitch_single_loop,
	unswitch_loop): Ditto.
	* tree-loop-linear.c (linear_transform_loops): Ditto.
	* tree-ssa-loop-im.c (determine_lsm, tree_ssa_lim_initialize,
	tree_ssa_lim): Ditto.
	* tree-ssa-loop-niter.c (estimate_numbers_of_iterations,
	free_numbers_of_iterations_estimates): Ditto.
	* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops,
	tree_unswitch_single_loop, tree_unswitch_loop): Ditto.
	* cfgloopmanip.c (fix_bb_placement, fix_bb_placements,
	remove_path, add_loop, loopify, unloop, fix_loop_placements,
	place_new_loop, duplicate_loop, duplicate_subloops,
	update_single_exit_for_duplicated_loops, copy_loops_to,
	duplicate_loop_to_header_edge, create_preheaders,
	force_single_succ_latches, loop_version, fix_loop_structure):
	Ditto.
	* tree-ssa-loop-manip.c (tree_duplicate_loop_to_header_edge,
	tree_unroll_loop): Ditto.
	* tree-ssa-loop-ch.c (copy_loop_headers): Ditto.
	* tree-scalar-evolution.c (select_loops_exit_conditions,
	scev_initialize, scev_analysis): Ditto.
	* tree-scalar-evolution.h (scev_initialize): Ditto.
	* cfghooks.c (cfg_hook_duplicate_loop_to_header_edge): Ditto.
	* cfgloopanal.c (mark_irreducible_loops, mark_loop_exit_edges): Ditto.
	* tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize): Ditto.
	* modulo-sched.c (sms_schedule): Ditto.
	* tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto.
	* loop-init.c (loop_optimizer_init, rtl_move_loop_invariants,
	rtl_unswitch, rtl_unroll_and_peel_loops, rtl_doloop): Ditto.
	* ifcvt.c (if_convert): Ditto.
	* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely,
	canonicalize_loop_induction_variables,
	canonicalize_induction_variables,
	tree_unroll_loops_completely, remove_empty_loops): Ditto.
	* tree-ssa-loop.c (tree_ssa_loop_init, tree_ssa_loop_im,
	tree_ssa_loop_unswitch, tree_vectorize, tree_linear_transform,
	tree_ssa_loop_ivcanon, tree_ssa_empty_loop, tree_ssa_loop_bounds,
	tree_complete_unroll, tree_ssa_loop_prefetch, tree_ssa_loop_ivopts,
	tree_ssa_loop_done): Ditto.
	* predict.c (predict_loops, tree_estimate_probability, estimate_loops,
	estimate_bb_frequencies): Ditto.
	* tree-vectorizer.c (slpeel_tree_duplicate_loop_to_edge_cfg,
	slpeel_tree_peel_loop_to_edge, vectorize_loops): Ditto.
	* loop-unroll.c (unroll_and_peel_loops, peel_loops_completely,
	decide_unrolling_and_peeling, peel_loop_completely,
	unroll_loop_constant_iterations, unroll_loop_runtime_iterations,
	peel_loop_simple, unroll_loop_stupid): Ditto.
	* loop-doloop.c (doloop_optimize_loops): Ditto.
	* tree-cfgcleanup.c (cleanup_tree_cfg_loop): Ditto.
	* loop-invariant.c (move_loop_invariants): Ditto.
	* tree-ssa-dce.c (tree_ssa_dce_loop): Ditto.
	* tree-ssa-loop-prefetch.c (loop_prefetch_arrays,
	tree_ssa_prefetch_arrays): Ditto.
	* lambda-code.c (gcc_loopnest_to_lambda_loopnest, perfect_nestify):
	Ditto.
	* tree-vect-transform.c (vect_do_peeling_for_loop_bound,
	vect_do_peeling_for_alignment, vect_transform_loop): Ditto.
	* cfgloop.c (flow_loops_cfg_dump, flow_loops_dump,
	mark_single_exit_loops, cancel_loop, cancel_loop_tree,
	verify_loop_structure): Ditto.
	* tree-flow.h (vectorize_loops, tree_ssa_lim, tree_ssa_unswitch_loops,
	canonicalize_induction_variables, tree_unroll_loops_completely,
	tree_ssa_prefetch_arrays, remove_empty_loops, tree_ssa_iv_optimize,
	estimate_numbers_of_iterations, free_numbers_of_iterations_estimates,
	tree_duplicate_loop_to_header_edge, tree_ssa_loop_version,
	tree_unroll_loop, linear_transform_loops): Declaration changed.
	* basic-block.h: Remove declaration of struct loops.
	* cfghooks.h (struct cfg_hooks): Change type of
	cfg_hook_duplicate_loop_to_header_edge.
	(cfg_hook_duplicate_loop_to_header_edge): Declaration changed.
	* tree-vectorizer.h (slpeel_tree_peel_loop_to_edge,
	vect_transform_loop): Declaration changed.
	* lambda.h (gcc_loopnest_to_lambda_loopnest): Declaration changed.
	* cfgloop.h (flow_loops_dump, fix_loop_structure,
	mark_irreducible_loops, mark_single_exit_loops, mark_loop_exit_edges,
	cancel_loop_tree, create_preheaders, force_single_succ_latches,
	verify_loop_structure, duplicate_loop, duplicate_loop_to_header_edge,
	loopify, loop_version, remove_path, unswitch_loops,
	unroll_and_peel_loops, doloop_optimize_loops, move_loop_invariants):
	Declaration changed.

From-SVN: r119189
2006-11-25 10:34:13 +00:00
Zdenek Dvorak ac8f6c6903 tree-loop-linear.c (linear_transform_loops): Use single_exit accessor functions.
* tree-loop-linear.c (linear_transform_loops): Use single_exit accessor
	functions.
	* tree-ssa-loop-niter.c (loop_only_exit_p): Ditto.
	* cfgloopmanip.c (update_single_exits_after_duplication,
	update_single_exit_for_duplicated_loop, loop_version): Ditto.
	* tree-scalar-evolution.c (get_loop_exit_condition,
	get_exit_conditions_rec, loop_closed_phi_def,
	number_of_iterations_in_loop, scev_const_prop): Ditto.
	* tree-ssa-loop-ivopts.c (single_dom_exit): Ditto.
	* modulo-sched.c (generate_prolog_epilog, loop_canon_p, sms_schedule):
	Ditto.
	* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
	Ditto.
	* tree-vectorizer.c (slpeel_update_phis_for_duplicate_loop,
	slpeel_update_phi_nodes_for_guard1, slpeel_update_phi_nodes_for_guard2,
	slpeel_make_loop_iterate_ntimes,
	slpeel_tree_duplicate_loop_to_edge_cfg, slpeel_can_duplicate_loop_p,
	slpeel_verify_cfg_after_peeling, slpeel_tree_peel_loop_to_edge):
	Ditto.
	* tree-if-conv.c (if_convertible_loop_p): Ditto.
	* tree-vect-analyze.c (vect_analyze_operations, vect_stmt_relevant_p,
	vect_analyze_loop_form): Ditto.
	* lambda-code.c (lambda_loopnest_to_gcc_loopnest, exit_phi_for_loop_p,
	can_convert_to_perfect_nest, perfect_nestify): Ditto.
	* tree-vect-transform.c (vect_create_epilog_for_reduction,
	vect_update_ivs_after_vectorizer, vect_do_peeling_for_loop_bound,
	vect_transform_loop): Ditto.
	* cfgloop.c (mark_single_exit_loops, verify_loop_structure): Ditto.
	(single_exit, set_single_exit): New functions.
	* cfgloop.h (struct loop): Rename single_exit field to single_exit_.
	(single_exit, set_single_exit): Declare.
	* doc/loop.texi: Undocument single_exit field.  Document single_exit
	accessor function.

From-SVN: r119075
2006-11-21 23:54:16 +00:00
Andrew Pinski c7f965b614 re PR tree-optimization/28937 (ICE in add_virtual_operand, at tree-ssa-operands.c:1309)
2006-09-05  Andrew Pinski  <pinskia@physics.uc.edu>

        PR tree-opt/28937
        * tree-flow.h (tree_ssa_unswitch_loops): Return unsigned int.
        (canonicalize_induction_variables): Likewise.
        (tree_unroll_loops_completely): Likewise.
        (tree_ssa_prefetch_arrays): Likewise.
        (remove_empty_loops): Likewise.
        * tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops): Return
        TODO_cleanup_cfg instead of directly calling
        cleanup_tree_cfg_loop.
        * tree-ssa-loop-ivcanon.c (canonicalize_induction_variables):
        Likewise.
        (tree_unroll_loops_completely): Likewise.
        (remove_empty_loops): Likewise.
        * tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Likewise.
        * tree-ssa-loop.c (tree_ssa_loop_unswitch): Use the return value
        of tree_ssa_unswitch_loops.
        (tree_ssa_loop_ivcanon): Use the return value of
        canonicalize_induction_variables.
        (tree_ssa_empty_loop): Use the return value of
        remove_empty_loops.
        (tree_complete_unroll): Use the return value of
        tree_unroll_loops_completely.
        (tree_ssa_loop_prefetch): Use the return value of
        tree_ssa_prefetch_arrays.
        * passes.c (execute_todo): Before Cleanup CFG, set
        updating_used_alone and after cleanup CFG, call
        recalculate_used_alone.
2006-09-05  Andrew Pinski  <pinskia@physics.uc.edu>

        PR tree-opt/28937
        * g++.dg/opt/unroll2.C: New test.

From-SVN: r116717
2006-09-05 23:13:22 -07:00
Marcin Dalecki 5ed6ace578 tree-vrp.c: Use XNEW/XCNEW allocation wrappers.
2006-01-31  Marcin Dalecki  <martin@dalecki.de>

	* tree-vrp.c: Use XNEW/XCNEW allocation wrappers.
	* regrename.c: Ditto.
	* tree-ssa-loop-im.c: Ditto.
	* tree-dump.c: Ditto.
	* tree-complex.c: Ditto.
	* genrecog.c: Ditto.
	* tree-ssa-threadupdate.c: Ditto.
	* tracer.c: Ditto.
	* java/class.c: Ditto.
	* java/jcf-parse.c: Ditto.
	* java/resource.c: Ditto.
	* java/except.c: Ditto.
	* java/jvspec.c: Ditto.
	* java/jcf-write.c: Ditto.
	* java/jcf-path.c: Ditto.
	* java/gjavah.c: Ditto.
	* java/zextract.c: Ditto.
	* java/jcf-io.c: Ditto.
	* java/jcf.h: Ditto.
	* java/buffer.c: Ditto.
	* java/lang.c: Ditto.
	* java/parse-scan.y: Ditto.
	* java/lex.c: Ditto.
	* java/lex.h: Ditto.
	* cfgloopmanip.c: Ditto.
	* postreload-gcse.c: Ditto.
	* tree-ssa-loop-manip.c: Ditto.
	* postreload.c: Ditto.
	* tree-ssa-loop-ch.c: Ditto.
	* loop.c: Ditto.
	* ipa-cp.c: Ditto.
	* cppspec.c: Ditto.
	* diagnostic.c: Ditto.
	* final.c: Ditto.
	* genoutput.c: Ditto.
	* gcc.c: Ditto.
	* cfghooks.c: Ditto.
	* cfgloopanal.c: Ditto.
	* objc/objc-act.c: Ditto.
	* gcov.c: Ditto.
	* genextract.c: Ditto.
	* genautomata.c: Ditto.
	* pretty-print.c: Ditto.
	* genemit.c: Ditto.
	* cgraphunit.c: Ditto.
	* flow.c: Ditto.
	* df-scan.c: Ditto.
	* haifa-sched.c: Ditto.
	* dominance.c: Ditto.
	* dbxout.c: Ditto.
	* tree-ssa-loop-ivopts.c: Ditto.
	* df-core.c: Ditto.
	* mode-switching.c: Ditto.
	* modulo-sched.c: Ditto.
	* graph.c: Ditto.
	* ipa-pure-const.c: Ditto.
	* cse.c: Ditto.
	* fix-header.c: Ditto.
	* web.c: Ditto.
	* tree-stdarg.c: Ditto.
	* ipa-utils.c: Ditto.
	* loop-init.c: Ditto.
	* ipa-inline.c: Ditto.
	* cfganal.c: Ditto.
	* global.c: Ditto.
	* alloc-pool.c: Ditto.
	* dwarf2out.c: Ditto.
	* opts.c: Ditto.
	* genattrtab.c: Ditto.
	* tree-ssa-loop-ivcanon.c: Ditto.
	* predict.c: Ditto.
	* timevar.c: Ditto.
	* lcm.c: Ditto.
	* fortran/gfortranspec.c: Ditto.
	* regmove.c: Ditto.
	* local-alloc.c: Ditto.
	* langhooks.c: Ditto.
	* function.c: Ditto.
	* tree-vectorizer.c: Ditto.
	* gcse.c: Ditto.
	* ipa-type-escape.c: Ditto.
	* alias.c: Ditto.
	* tree-if-conv.c: Ditto.
	* profile.c: Ditto.
	* ipa.c: Ditto.
	* tree-data-ref.c: Ditto.
	* loop-unroll.c: Ditto.
	* treelang/treetree.c: Ditto.
	* calls.c: Ditto.
	* bt-load.c: Ditto.
	* ggc-common.c: Ditto.
	* except.c: Ditto.
	* coverage.c: Ditto.
	* cselib.c: Ditto.
	* tree-cfgcleanup.c: Ditto.
	* tree-ssa-pre.c: Ditto.
	* cfgcleanup.c: Ditto.
	* loop-invariant.c: Ditto.
	* loop-iv.c: Ditto.
	* ipa-prop.c: Ditto.
	* print-tree.c: Ditto.
	* conflict.c: Ditto.
	* ggc-page.c: Ditto.
	* sched-deps.c: Ditto.
	* regclass.c: Ditto.
	* tree-object-size.c: Ditto.
	* combine.c: Ditto.
	* bb-reorder.c: Ditto.
	* resource.c: Ditto.
	* var-tracking.c: Ditto.
	* cfgloop.c: Ditto.
	* df-problems.c: Ditto.
	* reg-stack.c: Ditto.
	* tlink.c: Ditto.
	* gccspec.c: Ditto.
	* sched-rgn.c: Ditto.
	* tree-ssa-structalias.c: Ditto.
	* tree-ssa-reassoc.c: Ditto.
	* config/darwin-c.c: Ditto.
	* config/darwin.c: Ditto.
	* config/arm/arm.c: Ditto.
	* cfgrtl.c: Ditto.
	* collect2.c: Ditto.
	* reload1.c: Ditto.

From-SVN: r110446
2006-01-31 20:56:55 +01:00
Richard Guenther 57decb7e53 tree.c (tree_fold_gcd): Use build_int_cst where appropriate.
2005-12-22  Richard Guenther  <rguenther@suse.de>

	* tree.c (tree_fold_gcd): Use build_int_cst where appropriate.
	* tree-ssa-loop-ivcanon.c (create_canonical_iv): Likewise.
	* varasm.c (array_size_for_constructor): Likewise.
	* fold-const.c (size_diffop, invert_truthvalue,
	optimize_bit_field_compare, make_range, build_range_check,
	fold_cond_expr_with_comparison, fold_truthop,
	fold_single_bit_test_into_sign_test, fold_binary): Likewise.

From-SVN: r108970
2005-12-22 19:40:27 +00:00
Zdenek Dvorak 37261a5c97 re PR tree-optimization/23475 (Frequences are not updated for empty loop removal)
PR tree-optimization/23475
	* tree-ssa-loop-ivcanon.c (remove_empty_loop): Update frequencies
	and counts.

From-SVN: r103593
2005-08-29 07:13:06 +00:00
Sebastian Pop d77704579c re PR tree-optimization/22236 (wrong code for casts and scev)
PR tree-optimization/22236
	* tree-cfg.c (print_pred_bbs, print_succ_bbs): Correctly print
	successors and predecessors.
	* tree-chrec.c (chrec_convert): Before converting, check that
	sequences don't wrap.
	* tree-data-ref.c (compute_estimated_nb_iterations): Moved ...
	(analyze_array): Extern.
	(find_data_references_in_loop): Remove call to
	compute_estimated_nb_iterations.
	* tree-data-ref.h (analyze_array): Declared.
	* tree-flow-inline.h (single_ssa_tree_operand, single_ssa_use_operand,
	single_ssa_def_operand, zero_ssa_operands): Fix documentation.
	* tree-flow.h (scev_probably_wraps_p): Declare with an extra parameter.
	* tree-scalar-evolution.c (instantiate_parameters_1): Factor entry
	condition.
	* tree-ssa-loop-ivcanon.c: Fix documentation.
	* tree-ssa-loop-ivopts.c (idx_find_step): Add a fixme note.
	* tree-ssa-loop-niter.c (compute_estimated_nb_iterations): ... here.
	(infer_loop_bounds_from_undefined): New.
	(estimate_numbers_of_iterations_loop): Use
	infer_loop_bounds_from_undefined.
	(used_in_pointer_arithmetic_p): New.
	(scev_probably_wraps_p): Pass an extra parameter.  Call
	used_in_pointer_arithmetic_p.  Check that AT_STMT is not null.
	(convert_step): Fix documentation.
	* tree-vrp.c (adjust_range_with_scev): Call instantiate_parameters.
	Use initial_condition_in_loop_num and evolution_part_in_loop_num
	instead of CHREC_LEFT and CHREC_RIGHT.  Adjust the call to
	scev_probably_wraps_p.

From-SVN: r103055
2005-08-13 17:28:43 +00:00
Jan Hubicka 178df94ff1 cfgloop.h (DLTHE_FLAG_COMPLETTE_PEEL): New flag.
* cfgloop.h (DLTHE_FLAG_COMPLETTE_PEEL): New flag.
	* cfgloopmanip.c (duplicate_loop_to_header_edge): Special case
	profile updating for complette unrolling.
	* loop-unroll.c (peel_loop_completely): Use it.
	* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise.
	(tree_unroll_loops_completely): Disable code growing unrolling of cold
	loops.

	* update-conroll.c: New testcase.
	* update-conroll-2.c: New testcase.

From-SVN: r102687
2005-08-03 13:34:49 +00:00
Paolo Bonzini f9cc1a70d5 re PR rtl-optimization/19210 (not using do-loop for some loops)
gcc:
2005-07-21  Paolo Bonzini  <bonzini@gnu.org>
            Zdenek Dvorak  <dvorakz@suse.cz>

	PR tree-optimization/19210
	* common.opt (Wunsafe-loop-optimizations, funsafe-loop-optimizations):
	New.
	* Makefile.in (tree-ssa-loop-niter.o): Depend intl.o.
	* loop-iv.c (get_simple_loop_desc): If -funsafe-loop-optimizations,
	rely on unproven assumptions.
	* predict.c (predict_loops): Adjust call to number_of_iterations_exit.
	* tree-flow.h (number_of_iterations_exit): Add final parameter.
	* tree-scalar-evolution.c (number_of_iterations_in_loop): Adjust call
	to number_of_iterations_exit.
	* tree-ssa-loop-ivcanon.c (empty_loop_p): Likewise.
	* tree-ssa-loop-ivopts.c (niter_for_exit): Likewise.
	* tree-ssa-loop-niter.c (find_loop_niter,
	estimate_numbers_of_iterations_loop): Likewise.
	(number_of_iterations_exit): Honor the new options.
	* doc/invoke.texi (Wunsafe-loop-optimizations,
	funsafe-loop-optimizations): Document them.

gcc/testsuite:
2005-07-21  Paolo Bonzini  <bonzini@gnu.org>

        * gcc.dg/tree-ssa/pr19210-1.c: New.
        * gcc.dg/tree-ssa/pr19210-2.c: New.

Co-Authored-By: Zdenek Dvorak <dvorakz@suse.cz>

From-SVN: r102225
2005-07-21 07:24:34 +00:00
Zdenek Dvorak b7eae7b8d1 tree-flow.h (remove_empty_loops, [...]): Declare.
* tree-flow.h (remove_empty_loops, single_dom_exit): Declare.
	* passes.c (init_optimization_passes): Add pass_empty_loop.
	* tree-pass.h (pass_empty_loop): Declare.
	* tree-ssa-loop-ivcanon.c (empty_loop_p, remove_empty_loop,
	try_remove_empty_loop, remove_empty_loops): New functions.
	* tree-ssa-loop-ivopts.c (single_dom_exit): Export.
	* tree-ssa-loop.c (tree_ssa_empty_loop, pass_empty_loop): New.

	* gcc.dg/tree-ssa/loop-10.c: New test.

From-SVN: r101901
2005-07-11 23:59:17 +00:00
Kazu Hirata 987b67bc55 builtins.c, [...]: Use fold_buildN instead of fold (buildN (...)).
* builtins.c, c-common.c, c-convert.c, c-decl.c, c-typeck.c,
	convert.c, lambda-code.c, predict.c, tree-cfg.c,
	tree-complex.c, tree-data-ref.c, tree-if-conv.c,
	tree-mudflap.c, tree-scalar-evolution.c, tree-ssa-ccp.c,
	tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c,
	tree-ssa-loop-manip.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
	tree-vect-analyze.c, tree-vect-transform.c, tree-vectorizer.c,
	tree.c: Use fold_buildN instead of fold (buildN (...)).

From-SVN: r101338
2005-06-26 21:21:34 +00:00
Kelley Cook 366ccddb2b Update FSF address.
From-SVN: r101317
2005-06-25 02:02:01 +00:00
Jan Hubicka 6580ee7781 Makefile.in (cfg.o): Add new dependencies.
* Makefile.in (cfg.o): Add new dependencies.
	* basic-block.h (reorder_block_def): Kill
	original/copy/duplicated/copy_number fields.
	(BB_DUPLICATED): New flag.
	(initialize_original_copy_tables, free_original_copy_tables,
	set_bb_original, get_bb_original, set_bb_copy, get_bb_copy): New.
	* cfg.c: Include hashtab.h and alloc-pool.h
	(bb_original, bb_copy, original_copy_bb_pool): New static vars.
	(htab_bb_copy_original_entry): New struct.
	(bb_copy_original_hash, bb_copy_original_eq): New static functions.
	(initialize_original_copy_tables, free_original_copy_tables,
	set_bb_original, get_bb_original, set_bb_copy, get_bb_copy): New
	global functions.
	* cfghooks.c (duplicate_block): Update original/copy handling.
	* cfglayout.c (fixup_reorder_chain): Likewise.
	(cfg_layout_initialize): Initialize orignal_copy tables.
	(cfg_layout_finalize): FInalize original_copy tables.
	(can_copy_bbs_p): Use BB_DUPLICATED flag.
	(copy_bbs): Likewise.
	* cfgloopmanip.c (update-single_exits_after_duplication): Likewise.
	(duplicate_loop_to_header_edge): Likewise; update handling of
	copy_number.
	(loop_version): Likewise.
	* dominance.c (get_dominated_by_region): Use BB_DUPLICATED_FLAG.
	* except.c (expand_resx_expr): Check that reg->resume is not set.
	* loop-unroll.c (unroll_loop_constant_iterations,
	unroll_loop_runtime_iterations, apply_opt_in_copies): Update
	copy/original handling.
	* loop-unwitch.c (unswitch_loop): Likewise.
	* tree-cfg.c (create_bb): Do not initialize RBI.
	(disband_implicit_edges): Do not kill RBI.
	(add_phi_args_after_copy_bb): Use new original/copy mapping.
	(add_phi_args_after_copy): Use BB_DUPLICATED flag.
	(tree_duplicate_sese_region): Update original/copy handling.
	* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise.
	* tree-ssa-loop-manip.c (copy_phi_node_args): Likewise.
	* tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Likewise.

From-SVN: r101000
2005-06-15 23:05:23 +00:00
Kazu Hirata bb22512c9f tree-ssa-loop-ivcanon.c, [...]: Fix comment typos.
* tree-ssa-loop-ivcanon.c, config/i386/i386.c,
	config/rs6000/rs6000.h: Fix comment typos.

From-SVN: r99350
2005-05-07 14:43:55 +00:00
Zdenek Dvorak 91a01f21ab re PR tree-optimization/19401 (Trivial loop not unrolled)
PR tree-optimization/19401
	* tree-flow.h (tree_unroll_loops_completely): Declaration changed.
	* tree-ssa-loop-ivcanon.c (enum unroll_level): New.
	(estimated_unrolled_size): New function.
	(try_unroll_loop_completely, canonicalize_loop_induction_variables,
	tree_unroll_loops_completely): Always unroll loops if the code size
	does not increase.
	* tree-ssa-loop.c (tree_complete_unroll): Indicate whether all
	loops should be unrolled completely.
	(gate_tree_complete_unroll): Run complete unrolling unconditionally.

From-SVN: r99334
2005-05-06 21:11:29 +00:00
Diego Novillo 84d658141e [multiple changes]
2005-04-22  Diego Novillo  <dnovillo@redhat.com>

	* Makefile.in (tree-into-ssa.o): Add dependency on PARAMS_H.
	* lambda-code.c (perfect_nestify): Mark virtual operands in
	the moved statement for renaming.
	* params.def (PARAM_MIN_VIRTUAL_MAPPINGS): Define.
	(PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO): Define.
	* params.h (MIN_VIRTUAL_MAPPINGS): Define.
	(VIRTUAL_MAPPINGS_TO_SYMS_RATIO): Define.
	* tree-flow.h (struct var_ann_d): Update comments.
	(rewrite_to_new_ssa_names_bb, rewrite_to_new_ssa_names,
	allocate_ssa_names, find_phi_node_for, dump_tree_ssa,
	debug_tree_ssa, debug_def_blocks, dump_tree_ssa_stats,
	debug_tree_ssa_stats, rewrite_ssa_into_ssa,
	dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by,
	debug_names_replaced_by): Remove declarations.
	(delete_update_ssa, get_current_def, set_current_def): Declare.
	(rewrite_into_loop_closed_ssa): Add new argument.  Update
	all callers.
	* tree-into-ssa.c: Include params.h.
	(old_virtual_ssa_names): Remove.  Update all users.
	(need_to_replace_names_p): Remove.  Update all users.
	(struct update_ssa_stats_d): Declare.
	(update_ssa_stats): New local.
	(dump_tree_ssa, debug_tree_ssa, debug_def_blocks,
	dump_tree_ssa_stats, debug_tree_ssa_stats,
	dump_update_ssa, debug_update_ssa,
	dump_names_replaced_by, debug_names_replaced_by): Declare.
	(get_current_def, set current_def): Make extern.
	(is_old_name, is_new_name): Protect against references
	past the end of the sets.
	(add_new_name_mapping): Assert that OLD and NEW are
	different SSA names for the same symbol.
	When adding a virtual mapping, update stats for virtual
	mapping heuristic.
	(insert_phi_nodes_for): If UPDATE_P is true, create the
	LHS of the new PHI by duplicating SSA name VAR.
	(insert_phi_nodes_1): Remove.  Update all users.
	(insert_phi_nodes): Remove second argument.  Update all
	users.
	(maybe_replace_use, maybe_replace_def): New.
	(rewrite_update_stmt): Call them.
	(mark_def_interesting): Remove calls to is_gimple_reg.
	(prepare_phi_args_for_update): Remove.  Update all users.
	(prepare_block_for_update): Only process virtual operands
	and GIMPLE registers in normal form.
	(prepare_use_sites_for): New.
	(prepare_names_to_update): Rename from prepare_def_sites.
	Call prepare_use_sites_for.
	(dump_update_ssa): Rename from dump_repl_tbl.
	Update all users.
	Show statistics for virtual mapping heuristic.
	(debug_update_ssa): Rename from debug_debug_repl_tbl.
	(init_update_ssa): Initialize UPDATE_SSA_STATS.
	(delete_update_ssa): Make extern.
	(mark_set_for_renaming): If the set is empty, do nothing.
	(release_ssa_name_after_update_ssa): Update comment.
	(insert_updated_phi_nodes_for): Do not remove existing
	PHI nodes for symbols.
	(switch_virtuals_to_full_rewrite_p): New.
	(switch_virtuals_to_full_rewrite): New.
	(update_ssa): Call them.
	Clear REWRITE_THIS_STMT and REGISTER_DEFS_IN_THIS_STMT
	for every statement before updating.
	If all the names in NEW_SSA_NAMES have been marked for
	removal, do nothing.
	Only start at the top of the CFG if there are symbols in
	SYMS_TO_RENAME.
	(ssa_rewrite_finalize_block): Remove.
	(ssa_register_new_def): Remove.
	(ssa_rewrite_stmt): Remove.
	(ssa_rewrite_phi_arguments): Remove.
	(ssa_rewrite_initialize_block): Remove.
	(ssa_mark_def_sites): Remove.
	(ssa_mark_def_sites_initialize_block): Remove.
	(ssa_mark_phi_uses): Remove.
	(rewrite_ssa_into_ssa): Remove.
	* tree-phinodes.c (find_phi_node_for): Remove.
	* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely):
	Call update_ssa.
	* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops):
	Remove calls to verify_dominators and
	verify_loop_structure.
	(tree_unswitch_single_loop): Call update_ssa.
	* tree-ssa.c (verify_ssa): Assert that need_ssa_update_p
	returns false.
	Call verify_stmts.
	(delete_tree_ssa): Assert that need_ssa_update_p returns
	false.
	* tree-vect-transform.c (vect_transform_loop): Call update_ssa.
	* tree-vectorizer.c (allocate_new_names, rename_def_op,
	free_new_names): Remove.  Update all users.
	(rename_use_op): Call get_current_def.
	(rename_variables_in_bb): Do not handle any real or
	virtual definition.
	(slpeel_update_phis_for_duplicate_loop): Call
	get_current_def and set_current_def instead of using
	SSA_NAME_AUX.
	(slpeel_update_phi_nodes_for_guard2): Reformat comments.
	(slpeel_can_duplicate_loop_p): Call need_ssa_update_p,
	ssa_names_to_replace and delete_update_ssa.
	* doc/invoke.texi: Document --param min-virtual-mappings
	and --param virtual-mappings-ratio.

2005-04-22  Zdenek Dvorak  <dvorakz@suse.cz>
	    Diego Novillo  <dnovillo@redhat.com>

	* tree-cfg.c (tree_duplicate_bb): Call create_new_def_for
	for newly created PHI nodes.
	Call create_new_def_for for every new V_MAY_DEF and
	V_MUST_DEF on the copied statement.
	(struct ssa_name_map_entry): Remove.
	(ssa_name_map_entry_hash): Remove.
	(ssa_name_map_entry_eq): Remove.
	(allocate_ssa_names): Remove.
	(rewrite_to_new_ssa_names_def): Remove.
	(rewrite_to_new_ssa_names_use): Remove.
	(rewrite_to_new_ssa_names_bb): Remove.
	(rewrite_to_new_ssa_names): Remove.
	(tree_duplicate_sese_region): Remove variables ver,
	definitions, phi, ssa_name_map and bi.
	Call need_ssa_update_p instead of any_marked_for_rewrite_p.
	Call update_ssa.
	* tree-ssa-dom.c (tree_ssa_dominator_optimize): Call
	update_ssa instead of rewrite_ssa_into_ssa.
	* tree-ssa-loop-manip.c (add_exit_phis_edge): Call
	create_new_def_for.
	(find_uses_to_rename_use): Add argument 'need_phis'.
	(find_uses_to_rename_stmt): Do not scan virtual operands.
	(find_uses_to_rename): Only scan PHI nodes for
	non-virtual names.
	(rewrite_into_loop_closed_ssa): Call update_ssa.
	(check_loop_closed_ssa_use): Ignore virtual operands.
	(check_loop_closed_ssa_stmt): Likewise.
	(verify_loop_closed_ssa): Do nothing if CURRENT_LOOPS is
	NULL.
	(rename_variables, set_phi_def_stmts): Remove.
	(tree_duplicate_loop_to_header_edge): Reformat comment.
	Remove variables BB, I and DEFINITIONS.
	Call need_ssa_update_p.
	Call update_ssa.
	(lv_adjust_loop_header_phi): Reformat comment.
	* tree-ssanames.c (ssa_names_to_rewrite): Remove.
	(marked_for_rewrite_p, any_marked_for_rewrite_p,
	mark_for_rewrite, unmark_all_for_rewrite,
	marked_ssa_names): Remove.  Update all users.
	(release_ssa_name): If VAR has been registered for SSA
	updating, do nothing.
	* tree-vrp.c (new_ssa_names, old_ssa_names): Remove.
	(build_assert_expr_for): Call register_new_name_mapping.
	(insert_range_assertions): Update call to update_ssa.
	* tree.h (mark_for_rewrite, unmark_all_for_rewrite,
	marked_for_rewrite_p, any_marked_for_rewrite_p,
	marked_ssa_names): Remove.

From-SVN: r98599
2005-04-22 20:59:54 -04:00
Andrew MacLeod f430bae872 lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
2005-04-05  Andrew MacLeod  <amacleod@redhat.com>

	* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
	Use immediate use iterator.
	(stmt_is_bumper_for_loop): Use immediate use iterator.
	* predict.c (strip_builtin_expect): Use update_stmt.
	* tree-cfg.c (update_modified_stmts): New. Call update_stmt_if_modified
	on all elements of a STATEMENT_LIST.
	(bsi_insert_before, bsi_insert_after): Call update_modified_stmts.
	(bsi_remove): Remove imm_use links and mark the stmt as modified.
	(bsi_replace): Mark stmt as modified and the update it.
	* tree-complex.c (update_complex_assignment): Call mark_stmt_modified.
	(expand_complex_libcal): Call update_stmt.
	(expand_complex_comparison): Call mark_stmt_modified.
	(expand_complex_operations_1): Call update_stmt_if_modified.
	(expand_vector_operations_1): Call mark_stmt_modified.
	* tree-dfa.c (compute_immediate_uses, free_df_for_stmt, free_df,
	compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt,
	add_immediate_use, redirect_immediate_use,
	redirect_immediate_uses, dump_immediate_uses, debug_immediate_uses,
	dump_immediate_uses_for, debug_immediate_uses_for): Delete.
	(mark_new_vars_to_rename): Call update_stmt.
	* tree-dump.c (dump_option_value_in): Add "stmtaddr".
	* tree-flow-inline.h (modify_stmt): Rename to mark_stmt_modified.
	Ignore PHI nodes.
	(unmodify_stmt): Delete.
	(update_stmt): New.  Force an update of a stmt.
	(update_stmt_if_modified): update a stmt if it is out of date.
	(get_stmt_operands): Verify stmt is NOT modified.
	(stmt_modified_p): Update comment.
	(delink_imm_use): Remove a use node from its immuse list.
	(link_imm_use_to_list): Link a use node to a specific list.
	(link_imm_use): Link a node to the correct list.
	(set_ssa_use_from_ptr): Set a use node to a specific value, and insert
	it in the correct list, if appropriate.
	(link_imm_use_stmt): Link a use node, and set the stmt pointer.
	(relink_imm_use): Link a use node in place of another node in a list.
	(relink_imm_use_stmt): LInk a node in place of another node, and set
	the stmt pointer.
	(end_safe_imm_use_traverse): New.  Terminate a safe immuse iterator.
	(end_safe_imm_use_p): New.  Check for the end of a safe immuse iterator.
	(first_safe_imm_use): New.  Initialize a safe immuse iterator.
	(next_safe_imm_use): New.  Proceed to next safe immuse iterator value.
	(end_readonly_imm_use_p): New.  Check for end of a fast immuse iterator.
	(first_readonly_imm_use): New.  Initialize a fast immuse iterator.
	(next_readonly_imm_use): New.  Get the next fast immuse iterator value.
	(has_zero_uses): New.  Return true if there are no uses of a var.
	(has_single_use): New.  Return true if there is only a single use of a
	variable.
	(single_imm_use): New.  Return the simgle immediate use.
	(num_imm_uses): New.  Return the number of immediate uses.
	(get_v_must_def_ops): Use is now a pointer.
	(use_operand_p, get_v_may_def_op_ptr, get_vuse_op_ptr,
	get_v_must_def_kill_ptr, get_phi_arg_def_ptr): Return the address of
	the use node.
	(get_immediate_uses, num_immediate_uses, immediate_use): Delete.
	(delink_stmt_imm_use): Delink all immuses from a stmt.
	(phi_arg_index_from_use): New.  Return a phi arg index for a use.
	* tree-flow.h (struct dataflow_d): Delete.
	(immediate_use_iterator_d): New.  Immediate use iterator struct.
	(FOR_EACH_IMM_USE_FAST): New.  Macro for read only immuse iteration.
	(FOR_EACH_IMM_USE_SAFE): New.  Macro for write-safe immuse iteration.
	(BREAK_FROM_SAFE_IMM_USE): New.  Macro for earlyu exit from write-safe
	iteration.
	(struct stmt_ann_d): Remove dataflow_t from struct.
	* tree-if-conv.c (tree_if_conversion).  Don't call free_df.
	(if_convertible_phi_p): Use FAST immuse iterator.
	(if_convertible_loop_p): Don't call compute_immediate_uses.
	(replace_phi_with_cond_modify_expr): Call update_stmt.
	* tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites): Call
	update_stmt_if_modified.
	(rewrite_all_into_ssa): Initialize ssa operands.
	* tree-loop-linear.c (linear_transform_loops): Don't call free_df or
	compute_immediate_uses.
	* tree-optimize.c (execute_todo): Call verify_ssa whenever the
	ssa_property is available.
	(execute_one_pass):  Change parameters passed to execute_todo.
	* tree-outof-ssa.c (rewrite_trees): Don't call modify_stmt.
	(remove_ssa_form): Call fini_ssa_operands.
	(insert_backedge_copies): Delete call to modify_stmt.
	* tree-phinodes.c (make_phi_node): Initialize use nodes.
	(release_phi_node): Delink any use nodes before releasing.
	(resize_phi_node): Relink any use nodes.
	(remove_phi_arg_num): Delink the use node.
	(remove_phi_node): Release the ssa_name AFTER releasing the phi node.
	(remove_all_phi_nodes_for): Release phi node first.
	* tree-pretty-print.c (dump_generic_node): Print stmt address.
	* tree-sra.c (mark_all_v_defs): Call update_stmt_if_modified.
	(scalarize_use, scalarize_copy): Call update_stmt.
	* tree-ssa-alias.c (compute_may_aliases): Update all modified stmts.
	(compute_points_to_and_addr_escape): Call mark_stmt_modified.
	* tree-ssa-cpp.c (need_imm_uses_for): Delete.
	(ccp_initialize): Remove call to compute_immediate_uses.
	(substitute_and_fold, execute_fold_all_builtins): Call update_stmt.
	* tree-ssa-dom.c (tree_ssa_dominator_optimize): Update all modified
	stmts.
	(simplify_cond_and_lookup_avail_expr): Call mark_stmt_modified.
	(simplify_switch_and_lookup_avail_expr): Call mark_stmt_modified.
	(eliminate_redundant_computations): Call mark_stmt_modified.
	(cprop_operand): Call mark_stmt_modified.
	(optimize_stmt): Call update_stmt_if_modified and mark_stmt_modified.
	* tree-ssa-dse.c (fix_phi_uses, fix_stmt_v_may_defs): Delete.
	(dse_optimize_stmt): Use new immuse interface.
	(tree_ssa_dse): Remove calls to compute_immediate_uses and free_df.
	* tree-ssa-forwprop.c (need_imm_uses_for): Delete.
	(substitute_single_use_vars): Use new immuse interface.
	(tree_ssa_forward_propagate_single_use_vars): Remove calls to free_df
	and compute_immediate_uses.
	* tree-ssa-loop-im.c (single_reachable_address): Use new immuse
	interface.
	(rewrite_mem_refs): Call update_stmt.
	(determine_lsm): Remove call to compute_imm_uses and free_df.
	* tree-ssa-loop-ivcanon.c (create_canonical_iv): Call update_stmt.
	(try_unroll_loop_completely): Call update_stmt.
	* tree-ssa-loop-ivopts.c (rewrite_address_base): Call update_stmt.
	(rewrite_use_compare): Call update_stmt.
	(compute_phi_arg_on_exit): Insert each stmt before trying to process.
	(rewrite_use) : Call update_stmt.
	* tree-ssa-loop-manip.c (verify_loop_closed_ssa): Add arg to call.
	* tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Call
	update_stmt.
	* tree-ssa-operands.c (NULL_USE_OPERAND_P): Remove declaration.
	(allocate_use_optype, allocate_vuse_optype): Adjust allocation size.
	(free_uses, free_vuses, free_v_may_defs, free_v_must_defs): Delink
	use nodes.
	(initialize_vuse_operand): New.  Initialize a vuse operand.
	(initialize_v_may_def_operand): New.  Initialize a maydef operand.
	(initialize_v_must_def_operand): New.  Initialize a mustdef operand.
	(finalize_ssa_defs): Use stmt parameter.
	(correct_use_link): Ensure a use node is in the correct list, and has
	the correct stmt pointer.
	(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_vuses,
	finalize_ssa_v_must_defs): Also initialize use nodes.
	(finalize_ssa_stmt_operands): Pass extra stmt operands.
	(build_ssa_operands): Seperate parsing from final operand construction.
	(parse_ssa_operands): New.  Parse entry point for operand building.
	(swap_tree_operands): New.  Swap 2 tree operands.
	(update_stmt_operands): Ranamed from get_stmt_operands.  Always builds
	operands.
	(get_expr_operands): Call swap_tree_operands when needed.
	(copy_virtual_operands): Use initialize routines for virtual use ops.
	(create_ssa_artficial_load_stmt): Add extra stmt parameter.
	(verify_abort): New.  Issue imm_use error.
	(verify_imm_links): New Verify imm_use links for a var.
	(dump_immediate_uses_for): New.  Dump imm_uses for a var to file.
	(dump_immediate_uses): New.  Dump imm_uses for all vars to file.
	(debug_immediate_uses): New.  Dump imm_uses for all vars to stderr.
	(debug_immediate_uses_for): New.  Dump imm_uses for a var to stderr.
	* tree-ssa-operands.h (struct use_operand_ptr): Delete.
	(NULL_USE_OPERAND_P) Define.
	(use_optype_d, v_def_use_operand_type, vuse_optype_d): Add immediate
	use node.
	(struct vuse_operand_type): New struct.
	(SET_USE): Call set_ssa_use_from_ptr.
	(USE_STMT): Define.
	(PHI_ARG_INDEX_FROM_USE): Define.
	* tree-ssa-phiopt.c (replace_phi_edge_with_variable): Set the phi
	argument via SET_USE, not PHI_ARG_DEF_TREE.
	* tree-ssa-pre.c (eliminate): Call update_stmt.
	* tree-ssa-propagate.c (cfg_blocks_get): Use imm_use iterators.  Don't
	call free_df.
	* tree-ssa-sink.c (all_immediate_uses_same_place): Use imm_use iterator.
	(nearest_common_dominator_of_uses): Use imm_use iterator.
	(statement_sink_location): Use imm_use iterator and interface.
	(execute_sink_code): Don't call compute_immediate_uses or free-df.
	* tree-ssa-threadupdate.c (create_edge_and_update_destination_phis): Use
	PHI_ARG_DEF, not PHI_ARG_DEF_TREE.
	* tree-ssa.c (verify_use, verify_phi_args): Verify some imm_use info.
	(verify_ssa): Ensure no stmt is marked modify after optimization pass
	if new parameter is true.
	(init_tree_ssa): Don't initialize operand cache here.
	(delete_tree_ssa): Don't destroy operand cache here.
	(propagate_into_addr): Pass in a use pointer, return true if anything
	was changed.
	(replace_immediate_uses): Use imm_use iterator, call update_stmt.
	(check_phi_redundancy): Use imm_use iterator.
	(kill_redundant_phi_nodes): Don't call compute_immediate_uses or
	free_df.
	* tree-ssanames.c (make_ssa_name): Initialize imm_use node.
	(release_ssa_name): Delink node and all elements in its imm_use list.
	* tree-tailcall.c (adjust_return_value): Call update_stmt.
	* tree-vect-analyze.c (vect_stmt_relevant_p): Use imm_use iterator.
	* tree-vectorizer.c (need_imm_uses_for): Delete.
	(vectorize_loops): Dont call compute_immediate_uses or free_df.
	* tree.h (struct ssa_imm_use_d): Define.
	(SSA_NAME_IMM_USE_NODE): Define.
	(struct tree_ssa_name): Add imm_use node.
	(PHI_DF): Delete.
	(PHI_ARG_IMM_USE_NODE): Define.
	(struct phi_arg_d): Add imm_use node.
	(struct tree_phi_node): Remove struct dataflow_d element.
	(TDF_STMTADDR): Define.

From-SVN: r97648
2005-04-05 19:05:20 +00:00
Richard Guenther 37f7367a4d tree-ssa-loop.c (gate_tree_complete_unroll): Run complete unrolling if -fpeel-loops is specified, too.
2005-03-21  Richard Guenther  <rguenth@gcc.gnu.org>

	* tree-ssa-loop.c (gate_tree_complete_unroll): Run complete
	unrolling if -fpeel-loops is specified, too.
	* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely):
	Remove superfluous check for flag_unroll_loops.

From-SVN: r96808
2005-03-21 15:52:44 +00:00
Zdenek Dvorak 2b27100224 Makefile.in (tree-optimize.o): Add CFGLOOP_H dependence.
* Makefile.in (tree-optimize.o): Add CFGLOOP_H dependence.
	* cfgloop.c (flow_loop_nodes_find): Export.
	* cfgloop.h (flow_loop_nodes_find, fix_loop_structure):
	Declare.
	* cfgloopmanip.c (fix_loop_structure): New function.
	* predict.c (predict_loops): Clean up the loops information.
	* tree-cfg.c (cleanup_tree_cfg_loop): New function.
	(tree_can_merge_blocks_p, remove_bb, tree_forwarder_block_p): Respect
	loop structure.
	* tree-flow.h (cleanup_tree_cfg_loop): Declare.
	(rewrite_into_loop_closed_ssa): Declaration changed.
	* tree-loop-linear.c (linear_transform_loops): Add argument to
	rewrite_into_loop_closed_ssa call.
	* tree-ssa-loop-ch.c (copy_loop_headers): Ditto.
	* tree-ssa-loop-im.c (move_computations): Ditto.
	* tree-ssa-loop.c (tree_loop_optimizer_init): Ditto.
	* tree-vectorizer.c (vectorize_loops): Ditto.
	* tree-optimize.c: Include cfgloop.h.
	(execute_todo): Choose whether to call cleanup_tree_cfg or
	cleanup_tree_cfg_loop.
	* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables,
	(tree_unroll_loops_completely): Enable cleanup_tree_cfg_loop call.
	* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops): Enable
	cleanup_tree_cfg_loop call.
	* tree-ssa-loop-manip.c (find_uses_to_rename_bb): New function.
	(find_uses_to_rename, rewrite_into_loop_closed_ssa): Support
	work on part of cfg.

From-SVN: r96232
2005-03-10 08:55:57 +00:00
Kazu Hirata c486021de8 builtins.def, [...]: Update copyright.
* builtins.def, haifa-sched.c, libgcc2.c, libgcc2.h,
	tree-ssa-loop-ivcanon.c, tree-ssa-loop-niter.c,
	config/cris/cris-protos.h, config/cris/cris.c: Update
	copyright.

From-SVN: r94840
2005-02-10 18:59:07 +00:00
Zdenek Dvorak ca4c316991 re PR tree-optimization/18687 (>200% compile time regression compared to gcc-3.4)
PR tree-optimization/18687
	* tree-flow.h (find_loop_niter): Declare.
	* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
	Try using scev even for loops with more than one exit.
	* tree-ssa-loop-ivopts.c (struct loop_data): Removed niter field.
	(struct ivopts_data): Added niters field.
	(struct nfe_cache_elt): New.
	(nfe_hash, nfe_eq, niter_for_exit, niter_for_single_dom_exit): New
	functions.
	(tree_ssa_iv_optimize_init): Initialize niters cache.
	(determine_number_of_iterations): Removed.
	(find_induction_variables): Do not call determine_number_of_iterations.
	Access niters for single exit through niter_for_single_dom_exit.
	(add_iv_outer_candidates): Access niters for single exit through
	niter_for_single_dom_exit.
	(may_eliminate_iv): Take data argument.  Use niter_for_exit.  Do not use
	number_of_iterations_cond.
	(iv_period): New function.
	(determine_use_iv_cost_condition): Pass data to may_eliminate_iv.
	(may_replace_final_value): Take data argument.  Use
	niter_for_single_dom_exit.
	(determine_use_iv_cost_outer): Pass data to may_replace_final_value.
	(rewrite_use_compare): Pass data to may_eliminate_iv.
	(rewrite_use_outer): Pass data to may_replace_final_value.
	(free_loop_data): Clean up the niters cache.
	(tree_ssa_iv_optimize_finalize): Free the niters cache.
	(tree_ssa_iv_optimize_loop): Do not call loop_commit_inserts.
	* tree-ssa-loop-niter.c (find_loop_niter): New function.
	(find_loop_niter_by_eval): Use tree_int_cst_lt.
	(num_ending_zeros): Moved to tree.c.
	* tree.h (num_ending_zeros): Declare.
	* tree.c (num_ending_zeros): Moved from tree.c.

From-SVN: r94787
2005-02-10 00:32:47 +00:00
Zdenek Dvorak 47bcd07d56 common.opt (ftree-loop-ivcanon): Enable by default.
* common.opt (ftree-loop-ivcanon): Enable by default.
	* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely):
	Enable complete loop unrolling.
	(canonicalize_induction_variables, tree_unroll_loops_completely):
	Reset scev info.

	* gcc.dg/tree-ssa/loop-1.c: Check that unrolling occurs already on
	tree level.

From-SVN: r88404
2004-10-01 18:26:37 +00:00
Ben Elliston 628f6a4e7c backport: basic-block.h: Include vec.h, errors.h.
2004-09-24  Ben Elliston  <bje@au.ibm.com>
	    Steven Bosscher  <stevenb@suse.de>
	    Andrew Pinski  <pinskia@physics.uc.edu>

	Merge from edge-vector-branch:
	* basic-block.h: Include vec.h, errors.h. Instantiate a VEC(edge).
	(struct edge_def): Remove pred_next, succ_next members.
	(struct basic_block_def): Remove pred, succ members.  Add preds
	and succs members of type VEC(edge).
	(FALLTHRU_EDGE): Redefine using EDGE_SUCC.
	(BRANCH_EDGE): Likewise.
	(EDGE_CRITICAL_P): Redefine using EDGE_COUNT.
	(EDGE_COUNT, EDGE_I, EDGE_PRED, EDGE_SUCC): New.
	(edge_iterator): New.
	(ei_start, ei_last, ei_end_p, ei_one_before_end_p): New.
	(ei_next, ei_prev, ei_edge, ei_safe_edge): Likewise.
	(FOR_EACH_EDGE): New.
	* bb-reorder.c (find_traces): Use FOR_EACH_EDGE and EDGE_* macros
	where applicable.
	(rotate_loop): Likewise.
	(find_traces_1_route): Likewise.
	(bb_to_key): Likewise.
	(connect_traces): Likewise.
	(copy_bb_p): Likewise.
	(find_rarely_executed_basic_blocks_and_crossing_edges): Likewise.
	(add_labels_and_missing_jumps): Likewise.
	(fix_up_fall_thru_edges): Likewise.
	(find_jump_block): Likewise.
	(fix_crossing_conditional_branches): Likewise.
	(fix_crossing_unconditional_branches): Likewise.
	(add_reg_crossing_jump_notes): Likewise.
	* bt-load.c (augment_live_range): Likewise.
	* cfg.c (clear_edges): Likewise.
	(unchecked_make_edge): Likewise.
	(cached_make_edge): Likewise.
	(make_single_succ_edge): Likewise.
	(remove_edge): Likewise.
	(redirect_edge_succ_nodup): Likewise.
	(check_bb_profile): Likewise.
	(dump_flow_info): Likewise.
	(alloc_aux_for_edges): Likewise.
	(clear_aux_for_edges): Likewise.
	(dump_cfg_bb_info): Likewise.
	* cfganal.c (forwarder_block_p): Likewise.
	(can_fallthru): Likewise.
	(could_fall_through): Likewise.
	(mark_dfs_back_edges): Likewise.
	(set_edge_can_fallthru_flag): Likewise.
	(find_unreachable_blocks): Likewise.
	(create_edge_list): Likewise.
	(verify_edge_list): Likewise.
	(add_noreturn_fake_exit_edges): Likewise.
	(connect_infinite_loops_to_exit): Likewise.
	(flow_reverse_top_sort_order_compute): Likewise.
	(flow_depth_first_order_compute): Likewise.
	(flow_preorder_transversal_compute): Likewise.
	(flow_dfs_compute_reverse_execute): Likewise.
	(dfs_enumerate_from): Likewise.
	(compute_dominance_frontiers_1): Likewise.
	* cfgbuild.c (make_edges): Likewise.
	(compute_outgoing_frequencies): Likewise.
	(find_many_sub_basic_blocks): Likewise.
	(find_sub_basic_blocks): Likewise.
	* cfgcleanup.c (try_simplify_condjump): Likewise.
	(thread_jump): Likewise.
	(try_forward_edges): Likewise.
	(merge_blocks_move): Likewise.
	(outgoing_edges_match): Likewise.
	(try_crossjump_to_edge): Likewise.
	(try_crossjump_bb): Likewise.
	(try_optimize_cfg): Likewise.
	(merge_seq_blocks): Likewise.
	* cfgexpand.c (expand_gimple_tailcall): Likewise.
	(expand_gimple_basic_block): Likewise.
	(construct_init_block): Likewise.
	(construct_exit_block): Likewise.
	* cfghooks.c (verify_flow_info): Likewise.
	(dump_bb): Likewise.
	(delete_basic_block): Likewise.
	(split_edge): Likewise.
	(merge_blocks): Likewise.
	(make_forwarder_block): Likewise.
	(tidy_fallthru_edges): Likewise.
	(can_duplicate_block_p): Likewise.
	(duplicate_block): Likewise.
	* cfglayout.c (fixup_reorder_chain): Likewise.
	(fixup_fallthru_exit_predecessor): Likewise.
	(can_copy_bbs_p): Likewise.
	(copy_bbs): Likewise.
	* cfgloop.c (flow_loops_cfg_dump): Likewise.
	(flow_loop_entry_edges_find): Likewise.
	(flow_loop_exit_edges_find): Likewise.
	(flow_loop_nodes_find): Likewise.
	(mark_single_exit_loops): Likewise.
	(flow_loop_pre_header_scan): Likewise.
	(flow_loop_pre_header_find): Likewise.
	(update_latch_info): Likewise.
	(canonicalize_loop_headers): Likewise.
	(flow_loops_find): Likewise.
	(get_loop_body_in_bfs_order): Likewise.
	(get_loop_exit_edges): Likewise.
	(num_loop_branches): Likewise.
	(verify_loop_structure): Likewise.
	(loop_latch_edge): Likewise.
	(loop_preheader_edge): Likewise.
	* cfgloopanal.c (mark_irreducible_loops): Likewise.
	(expected_loop_iterations): Likewise.
	* cfgloopmanip.c (remove_bbs): Likewise.
	(fix_bb_placement): Likewise.
	(fix_irreducible_loops): Likewise.
	(remove_path): Likewise.
	(scale_bbs_frequencies): Likewise.
	(loopify): Likewise.
	(unloop): Likewise.
	(fix_loop_placement): Likewise.
	(loop_delete_branch_edge): Likewise.
	(duplicate_loop_to_header_edge): Likewise.
	(mfb_keep_just): Likewise.
	(create_preheader): Likewise.
	(force_single_succ_latches): Likewise.
	(loop_split_edge_with): Likewise.
	(create_loop_notes): Likewise.
	* cfgrtl.c (rtl_split_block): Likewise.
	(rtl_merge_blocks): Likewise.
	(rtl_can_merge_blocks): Likewise.
	(try_redirect_by_replacing_jump): Likewise.
	(force_nonfallthru_and_redirect): Likewise.
	(rtl_tidy_fallthru_edge): Likewise.
	(commit_one_edge_insertion): Likewise.
	(commit_edge_insertions): Likewise.
	(commit_edge_insertions_watch_calls): Likewise.
	(rtl_verify_flow_info_1): Likewise.
	(rtl_verify_flow_info): Likewise.
	(purge_dead_edges): Likewise.
	(cfg_layout_redirect_edge_and_branch): Likewise.
	(cfg_layout_can_merge_blocks_p): Likewise.
	(rtl_flow_call_edges_add): Likewise.
	* cse.c (cse_cc_succs): Likewise.
	* df.c (hybrid_search): Likewise.
	* dominance.c (calc_dfs_tree_nonrec): Likewise.
	(calc_dfs_tree): Likewise.
	(calc_idoms): Likewise.
	(recount_dominator): Likewise.
	* domwalk.c (walk_dominator_tree): Likewise.
	* except.c (emit_to_new_bb_before): Likewise.
	(connect_post_landing_pads): Likewise.
	(sjlj_emit_function_enter): Likewise.
	(sjlj_emit_function_exit): Likewise.
	(finish_eh_generation): Likewise.
	* final.c (compute_alignments): Likewise.
	* flow.c (calculate_global_regs_live): Likewise.
	(initialize_uninitialized_subregs): Likewise.
	(init_propagate_block_info): Likewise.
	* function.c (thread_prologue_and_epilogue_insns): Likewise.
	* gcse.c (find_implicit_sets): Likewise.
	(bypass_block): Likewise.
	(bypass_conditional_jumps): Likewise.
	(compute_pre_data): Likewise.
	(insert_insn_end_bb): Likewise.
	(insert_store): Likewise.
	(remove_reachable_equiv_notes): Likewise.
	* global.c (global_conflicts): Likewise.
	(calculate_reg_pav): Likewise.
	* graph.c (print_rtl_graph_with_bb): Likewise.
	* ifcvt.c (mark_loop_exit_edges): Likewise.
	(merge_if_block): Likewise.
	(find_if_header): Likewise.
	(block_jumps_and_fallthru_p): Likewise.
	(find_if_block): Likewise.
	(find_cond_trap): Likewise.
	(block_has_only_trap): Likewise.
	(find_if_case1): Likewise.
	(find_if_case_2): Likewise.
	* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Likewise.
	(perfect_nestify): Likewise.
	* lcm.c (compute_antinout_edge): Likewise.
	(compute_laterin): Likewise.
	(compute_available): Likewise.
	(compute_nearerout): Likewise.
	* loop-doloop.c (doloop_modify): Likewise.
	* loop-init.c (loop_optimizer_init): Likewise.
	* loop-invariant.c (find_exits): Likewise.
	* loop-iv.c (simplify_using_initial_values): Likewise.
	(check_simple_exit): Likewise.
	(find_simple_exit): Likewise.
	* loop-unroll.c (peel_loop_completely): Likewise.
	(unroll_loop_constant_iterations): Likewise.
	(unroll_loop_runtime_iterations): Likewise.
	* loop-unswitch.c (may_unswitch_on): Likewise.
	(unswitch_loop): Likewise.
	* modulo-sched.c (generate_prolog_epilog): Likewise.
	(sms_schedule): Likewise.
	* postreload-gcse.c (eliminate_partially_redundant_load):
	Likewise.
	* predict.c (can_predict_insn_p): Likewise.
	(set_even_probabilities): Likewise.
	(combine_predictions_for_bb): Likewise.
	(predict_loops): Likewise.
	(estimate_probability): Likewise.
	(tree_predict_by_opcode): Likewise.
	(tree_estimate_probability): Likewise.
	(last_basic_block_p): Likewise.
	(propagate_freq): Likewise.
	(estimate_loops_at_level): Likewise.
	(estimate_bb_frequencies): Likewise.
	* profile.c (instrument_edges): Likewise.
	(get_exec_counts): Likewise.
	(compute_branch_probabilities): Likewise.
	(branch_prob): Likewise.
	* ra-build.c (live_in): Likewise.
	* ra-rewrite.c (rewrite_program2): Likewise.
	* ra.c (reg_alloc): Likewise.
	* reg-stack.c (reg_to_stack): Likewise.
	(convert_regs_entry): Likewise.
	(compensate_edge): Likewise.
	(convert_regs_1): Likewise,
	(convert_regs_2): Likewise.
	(convert_regs): Likewise.
	* regrename.c (copyprop_hardreg_forward): Likewise.
	* reload1.c (fixup_abnormal_edges): Likewise.
	* sbitmap.c (sbitmap_intersection_of_succs): Likewise.
	(sbitmap_insersection_of_preds): Likewise.
	(sbitmap_union_of_succs): Likewise.
	(sbitmap_union_of_preds): Likewise.
	* sched-ebb.c (compute_jump_reg_dependencies): Likewise.
	(fix_basic_block_boundaries): Likewise.
	(sched_ebbs): Likewise.
	* sched-rgn.c (build_control_flow): Likewise.
	(find_rgns): Likewise.
	* tracer.c (find_best_successor): Likewise.
	(find_best_predecessor): Likewise.
	(tail_duplicate): Likewise.
	* tree-cfg.c (make_edges): Likewise.
	(make_ctrl_stmt_edges): Likewise.
	(make_goto_expr_edges): Likewise.
	(tree_can_merge_blocks_p): Likewise.
	(tree_merge_blocks): Likewise.
	(cfg_remove_useless_stmts_bb): Likewise.
	(remove_phi_nodes_and_edges_for_unreachable_block): Likewise.
	(tree_block_forwards_to): Likewise.
	(cleanup_control_expr_graph): Likewise.
	(find_taken_edge): Likewise.
	(dump_cfg_stats): Likewise.
	(tree_cfg2vcg): Likewise.
	(disband_implicit_edges): Likewise.
	(tree_find_edge_insert_loc): Likewise.
	(bsi_commit_edge_inserts): Likewise.
	(tree_split_edge): Likewise.
	(tree_verify_flow_info): Likewise.
	(tree_make_forwarder_block): Likewise.
	(tree_forwarder_block_p): Likewise.
	(thread_jumps): Likewise.
	(tree_try_redirect_by_replacing_jump): Likewise.
	(tree_split_block): Likewise.
	(add_phi_args_after_copy_bb): Likewise.
	(rewrite_to_new_ssa_names_bb): Likewise.
	(dump_function_to_file): Likewise.
	(print_pred_bbs): Likewise.
	(print_loop): Likewise.
	(tree_flow_call_edges_add): Likewise.
	(split_critical_edges): Likewise.
	(execute_warn_function_return): Likewise.
	(extract_true_false_edges_from_block): Likewise.
	* tree-if-conv.c (tree_if_conversion): Likewise.
	(if_convertable_bb_p): Likewise.
	(find_phi_replacement_condition): Likewise.
	(combine_blocks): Likewise.
	* tree-into-ssa.c (compute_global_livein): Likewise.
	(ssa_mark_phi_uses): Likewise.
	(ssa_rewrite_initialize_block): Likewise.
	(rewrite_add_phi_arguments): Likewise.
	(ssa_rewrite_phi_arguments): Likewise.
	(insert_phi_nodes_for): Likewise.
	(rewrite_into_ssa): Likewise.
	(rewrite_ssa_into_ssa): Likewise.
	* tree-mudflap.c (mf_build_check_statement_for): Likewise.
	* tree-outof-ssa.c (coalesce_abnormal_edges): Likewise.
	(rewrite_trees): Likewise.
	* tree-pretty-print.c (dump_bb_header): Likewise.
	(dump_implicit_edges): Likewise.
	* tree-sra.c (insert_edge_copies): Likewise.
	(find_obviously_necessary_stmts): Likewise.
	(remove_data_stmt): Likewise.
	* tree-ssa-dom.c (thread_across_edge): Likewise.
	(dom_opt_finalize_block): Likewise.
	(single_incoming_edge_ignoring_loop_edges): Likewise.
	(record_equivalences_from_incoming_edges): Likewise.
	(cprop_into_successor_phis): Likewise.
	* tree-ssa-live.c (live_worklist): Likewise.
	(calculate_live_on_entry): Likewise.
	(calculate_live_on_exit): Likewise.
	* tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Likewise.
	(copy_loop_headers): Likewise.
	* tree-ssa-loop-im.c (loop_commit_inserts): Likewise.
	(fill_always_executed_in): Likewise.
	* tree-ssa-loop-ivcanon.c (create_canonical_iv): Likewise.
	* tree-ssa-loop-ivopts.c (find_interesting_uses): Likewise.
	(compute_phi_arg_on_exit): Likewise.
	* tree-ssa-loop-manip.c (add_exit_phis_edge): Likewise.
	(get_loops_exit): Likewise.
	(split_loop_exit_edge): Likewise.
	(ip_normal_pos): Likewise.
	* tree-ssa-loop-niter.c (simplify_using_initial_conditions):
	Likewise.
	* tree-ssa-phiopt.c (candidate_bb_for_phi_optimization): Likewise.
	(replace_phi_with_stmt): Likewise.
	(value_replacement): Likewise.
	* tree-ssa-pre.c (compute_antic_aux): Likewise.
	(insert_aux): Likewise.
	(init_pre): Likewise.
	* tree-ssa-propagate.c (simulate_stmt): Likewise.
	(simulate_block): Likewise.
	(ssa_prop_init): Likewise.
	* tree-ssa-threadupdate.c (thread_block): Likewise.
	(create_block_for_threading): Likewise.
	(remove_last_stmt_and_useless_edges): Likewise.
	* tree-ssa.c (verify_phi_args): Likewise.
	(verify_ssa): Likewise.
	* tree_tailcall.c (independent_of_stmt_p): Likewise.
	(find_tail_calls): Likewise.
	(eliminate_tail_call): Likewise.
	(tree_optimize_tail_calls_1): Likewise.
	* tree-vectorizer.c (vect_transform_loop): Likewise.
	* var-tracking.c (prologue_stack_adjust): Likewise.
	(vt_stack_adjustments): Likewise.
	(vt_find_locations): Likewise.
	* config/frv/frv.c (frv_ifcvt_modify_tests): Likewise.
	* config/i386/i386.c (ix86_pad_returns): Likewise.
	* config/ia64/ia64.c (ia64_expand_prologue): Likewise.
	* config/rs6000/rs6000.c (rs6000_emit_prologue): Likewise.

Co-Authored-By: Andrew Pinski <pinskia@physics.uc.edu>
Co-Authored-By: Steven Bosscher <stevenb@suse.de>

From-SVN: r88222
2004-09-28 17:59:54 +10:00
Daniel Berlin 1b08d87d34 common.opt: Rename ivcanon to tree-loop-ivcanon, tree-lim to tree-loop-im.
2004-09-02  Daniel Berlin  <dberlin@dberlin.org>

	* gcc/common.opt: Rename ivcanon to tree-loop-ivcanon, tree-lim to
	tree-loop-im.
	* gcc/tree-ssa-loop.c: Ditto
	* gcc/tree-ssa-loop-ivcanon.c: Ditto
	* gcc/doc/invoke.texi: Ditto.

From-SVN: r87023
2004-09-03 02:19:40 +00:00
Nathan Sidwell 7d60be94d6 tree.h (build_int_cst): New, sign extended constant.
* tree.h  (build_int_cst): New, sign extended constant.
	(build_int_cstu): New, zero extended constant.
	(build_int_cst_wide): Renamed from build_int_cst.
	* tree.c (build_int_cst, build_int_cstu): New.
	(build_int_cst_wide): Renamed from build_int_cst.
	(make_vector_type, build_common_tree_nodes,
	build_common_tree_nodes_2): Adjust build_int_cst calls.
	* builtins.c (expand_builtin_prefetch, expand_builtin_strstr,
	expand_builtin_strpbrk, expand_builtin_fputs,
	build_string_literal, expand_builtin_printf,
	expand_builtin_sprintf, fold_builtin_classify_type,
	fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii,
	fold_builtin_toascii, fold_builtin_isdigit,
	simplify_builtin_strstr, simplify_builtin_strpbrk,
	fold_builtin_fputs, simplify_builtin_sprintf): Likewise.
	* c-common.c (start_fname_decls, fix_string_type, shorten_compare,
	DEF_ATTR_INT): Likewise.
	* c-decl.c (complete_array_type, check_bitfield_type_and_width):
	Likewise.
	* c-lex.c (interpret_integer, lex_charconst): Likewise.
	* c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise.
	* c-pretty-print.c (pp_c_integer_constant): Likewise.
	* c-typeck.c (really_start_incremental_init, push_init_level,
	set_nonincremental_init_from_string): Likewise.
	* calls.c (load_register_parameters): Likewise.
	convert.c (convert_to_pointer): Likewise.
	coverage.c (coverage_counter_alloc, tree_coverage_counter_ref,
	build_fn_info_type, build_fn_info_value, build_ctr_info_value,
	build_gcov_info): Likewise.
	* except.c (init_eh, assign_filter_values): Likewise.
	* expmed.c (store_fixed_bit_field, extract_bit_field,
	extract_fixed_bit_field, extract_split_bit_field, expand_shift,
	expand_mult_const, expand_mult_highpart_adjust, extract_high_half,
	expand_sdiv_pow2, expand_divmod, make_tree): Likewise.
	* expr.c (convert_move, emit_group_load, emit_group_store,
	expand_assignment, store_constructor, store_field,
	expand_expr_real_1, reduce_to_bit_field_precision): Likewise.
	fold-const.c (force_fit_type, int_const_binop, fold_convert_const,
	invert_truthvalue, optimize_bit_field_compare,
	decode_field_reference, all_ones_mask_p, constant_boolean_node,
	fold_div_compare, fold, fold_read_from_constant_string,
	fold_negate_const, fold_abs_const, fold_not_const, round_up,
	round_down): Likewise.
	* function.c (assign_parm_setup_block): Likewise.
	* stmt.c (shift_return_value, expand_case, estimate_case_costs):
	Likewise.
	* stor-layout.c (layout_type, initialize_sizetypes,
	set_min_and_max_values_for_integral_type): Likewise.
	* tree-chrec.c (chrec_fold_multiply_poly_poly,
	reset_evolution_in_loop): Likewise.
	* tree-chrec.h (build_polynomial_chrec): Likewise.
	* tree-complex.c (build_replicated_const): Likewise.
	* tree-eh.c (honor_protect_cleanup_actions,
	lower_try_finally_onedest, lower_try_finally_copy,
	lower_try_finally_switch): Likewise.
	* tree-mudflap.c (mf_build_string, mx_register_decls,
	mudflap_register_call, mudflap_enqueue_constant): Likewise.
	* tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise.
	* tree-pretty-print.c (dump_generic_node): Likewise.
	* tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref):
	Likewise.
	* tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise.
	* tree-ssa-loop-niter.c (number_of_iterations_cond,
	loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type):
	Likewise.
	* tree-ssa-loop-ivcanon.c (create_canonical_iv,
	canonicalize_loop_induction_variables): Likewise.
	* tree-vectorizer.c (vect_create_index_for_array_ref,
	vect_transform_loop_bound, vect_compute_data_ref_alignment):
	Likewise.

	* config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start,
	alpha_gimplify_va_arg_1): Likewise.
	* config/arm/arm.c (arm_get_cookie_size): Likewise.
	* config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise.
	* config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise.
	* config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise.
	* config/mips/mips.c (mips_build_builtin_va_list, mips_va_start,
	mips_gimplify_va_arg_expr): Likewise.
	* config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise.
	* config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg,
	add_compiler_branch_island): Likewise.
	* config/s390/s390.c (s390_va_start): Likewise.
	* config/sh/sh.c (sh_va_start): Likewise.
	* config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start):
	Likewise.
	* config/xtensa/xtensa.c (xtensa_va_start,
	xtensa_gimplify_va_arg_expr): Likewise.

	* objc/objc-act.c (build_objc_string_object,
	build_objc_symtab_template, init_def_list, init_objc_symtab,
	init_module_descriptor, generate_static_references,
	build_selector_translation_table, get_proto_encoding,
	build_typed_selector_reference, build_selector_reference,
	build_next_objc_exception_stuff,
	build_method_prototype_list_template, generate_descriptor_table,
	generate_protocols, build_protocol_initializer,
	build_ivar_list_template, build_method_list_template,
	build_ivar_list_initializer, generate_ivars_list,
	generate_dispatch_table, generate_protocol_list,
	build_category_initializer, build_shared_structure_initializer,
	generate_shared_structures, handle_impent,
	generate_objc_image_info): Likewise.

2004-04-25  Paolo Bonzini  <bonzini@gnu.org>

	* cfglayout.c (duplicate_insn_chain): Remove references to
	NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT.
	* cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator.
	* cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT.
	* final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP
	and NOTE_INSN_LOOP_CONT.
	* insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove.
	* jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP
	and NOTE_INSN_LOOP_CONT.
	* loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop,
	check_dbra_loop, loop_dump_aux): Remove references to removed notes
	and fields.
	* reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs.
	* unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove
	references to removed notes and fields.
	(subtract_reg_term, ujump_to_loop_cont): Remove.

From-SVN: r86544
2004-08-25 09:52:54 +00:00
Zdenek Dvorak 82b85a85c8 tree-ssa-loop-ivcanon.c: New file.
* tree-ssa-loop-ivcanon.c: New file.
	* tree-ssa-loop-manip.c (create_iv): New function.
	* Makefile.in (tree-ssa-loop-ivcanon.o): Add.
	(tree-ssa-loop.o, tree-ssa-loop-manip.o): Add SCEV_H dependency.
	* cfgloop.c (mark_single_exit_loops): New function.
	(verify_loop_structure): Verify single-exit loops.
	* cfgloop.h (struct loop): Add single_exit field.
	(LOOPS_HAVE_MARKED_SINGLE_EXITS): New constant.
	(mark_single_exit_loops): Declare.
	(tree_num_loop_insns): Declare.
	* cfgloopmanip.c (update_single_exits_after_duplication): New function.
	(duplicate_loop_to_header_edge): Use it.
	* common.opt (fivcanon): New flag.
	* timevar.def (TV_TREE_LOOP_IVCANON, TV_COMPLETE_UNROLL): New timevars.
	* tree-cfg.c (tree_find_edge_insert_loc): Return newly created block.
	(bsi_commit_edge_inserts_1): Pass null to tree_find_edge_insert_loc.
	(bsi_insert_on_edge_immediate): New function.
	* tree-flow.h (bsi_insert_on_edge_immediate,
	canonicalize_induction_variables, tree_unroll_loops_completely,
	create_iv): Declare.
	* tree-optimize.c (init_tree_optimization_passes): Add
	pass_iv_canon and pass_complete_unroll.
	* tree-pass.h (pass_iv_canon, pass_complete_unroll): Declare.
	* tree-scalar-evolution.c (get_loop_exit_condition,
	get_exit_conditions_rec, number_of_iterations_in_loop,
	scev_initialize): Use single_exit information.
	* tree-ssa-loop-niter.c (number_of_iterations_cond): Record
	missing assumptions.
	(loop_niter_by_eval):  Return number of iterations as unsigned
	int.
	* tree-ssa-loop.c (tree_ssa_loop_init): Mark single exit loops.
	(tree_ssa_loop_ivcanon, gate_tree_ssa_loop_ivcanon, pass_iv_canon,
	tree_complete_unroll, gate_tree_complete_unroll, pass_complete_unroll):
	New passes.
	(tree_ssa_loop_done): Call free_numbers_of_iterations_estimates.
	* tree-ssanames.c (make_ssa_name): Allow creating ssa name before
	the defining statement is ready.
	* tree-vectorizer.c (vect_create_iv_simple): Removed.
	(vect_create_index_for_array_ref, vect_transform_loop_bound):
	Use create_iv.
	(vect_transform_loop_bound): Use single_exit information.
	(vect_analyze_loop_form): Cleanup bogus tests.
	(vectorize_loops): Do not call flow_loop_scan.
	* tree.h (may_negate_without_overflow_p): Declare.
	* fold-const.c (may_negate_without_overflow_p): Split out from ...
	(negate_expr_p): ... this function.
	(tree_expr_nonzero_p): Handle overflowed constants correctly.
	* doc/invoke.texi (-fivcanon): Document.
	* doc/passes.texi: Document canonical induction variable creation.

	* gcc.dg/tree-ssa/loop-1.c: New test.

From-SVN: r86516
2004-08-24 20:48:23 +00:00