summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-niter.c
Commit message (Collapse)AuthorAgeFilesLines
* ./:ian2007-01-281-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common.opt: Add fstrict-overflow. * opts.c (decode_options): Set flag_strict_overflow if -O2. * flags.h (TYPE_OVERFLOW_WRAPS): Define. (TYPE_OVERFLOW_UNDEFINED): Define. (TYPE_OVERFLOW_TRAPS): Define. This replaces TYPE_TRAP_SIGNED. Replace all uses. * tree.h (TYPE_TRAP_SIGNED): Don't define. * fold-const.c (negate_expr_p): Use TYPE_OVERFLOW_UNDEFINED. (fold_negate_expr): Likewise. (make_range): Likewise. (extract_muldiv_1): Likewise. (maybe_canonicalize_comparison): Likewise. (fold_comparison): Likewise. (fold_binary): Likewise. (tree_expr_nonnegative_p): Likewise. (tree_expr_nonzero_p): Likewise. * tree-vrp.c (compare_values): Likewise. (extract_range_from_binary_expr): Likewise. (extract_range_from_unary_expr): Likewise. * tree-ssa-loop-niter.c (infer_loop_bounds_from_signedness): Likewise. (nowrap_type_p): Likewise. * tree-scalar-evolution.c (simple_iv): Likewise. * fold-const.c (negate_expr_p): Use TYPE_OVERFLOW_WRAPS. (build_range_check): Likewise. (extract_muldiv_1): Likewise. (fold_comparison): Likewise. * tree-vrp.c (vrp_int_const_binop): Likewise. (extract_range_from_unary_expr): Likewise. * convert.c (convert_to_integer): Likewise. * fold-const.c (fold_negate_expr): Use TYPE_OVERFLOW_TRAPS. (fold_comparison): Likewise. (fold_binary): Likewise. * optabs.c (optab_for_tree_code): Likewise. * tree-vectorizer.c (vect_is_simple_reduction): Likewise. * simplify-rtx.c (simplify_const_relational_operation): Check flag_strict_overflow and flag_trapv. (simplify_const_relational_operation): Likewise. * doc/invoke.texi (Option Summary): Mention -fstrict-overflow. (Optimize Options): Add -fstrict-overflow to -O2 list. Document -fstrict-overflow. testsuite/: * gcc.dg/strict-overflow-1.c: New test. * gcc.dg/no-strict-overflow-1.c: New test. * gcc.dg/strict-overflow-2.c: New test. * gcc.dg/no-strict-overflow-2.c: New test. * gcc.dg/strict-overflow-3.c: New test. * gcc.dg/no-strict-overflow-3.c: New test. * gcc.dg/strict-overflow-4.c: New test. * gcc.dg/no-strict-overflow-4.c: New test. * gcc.dg/fold-mod-1.c: Add -fstrict-overflow option. * gcc.dg/pr15784-1.c: Likewise. * gcc.dg/pr20922-1.c: Likewise. * gcc.dg/pr20922-3.c: Likewise. * gcc.dg/pr20922-4.c: Likewise. * gcc.dg/pr20922-6.c: Likewise. * gcc.dg/compare-4.c: Likewise. * gcc.dg/torture/pr26898-1.c: Likewise. * gcc.dg/tree-ssa/divide-1.c: Likewise. * gcc.dg/tree-ssa/divide-2.c: Likewise. * gcc.dg/tree-ssa/divide-3.c: Likewise. * gcc.dg/tree-ssa/divide-4.c: Likewise. * gcc.dg/tree-ssa/pr14490-1.c: Likewise. * gcc.dg/tree-ssa/pr14490-3.c: Likewise. * gcc.dg/tree-ssa/pr21082.c: Likewise. * gcc.dg/tree-ssa/pr26899.c: Likewise. * g++.dg/tree-ssa/pr21082.C: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121254 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree-ssa-loop-niter.c (number_of_iterations_lt_to_ne,rakdver2006-12-231-23/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | assert_no_overflow_lt, assert_loop_rolls_lt, number_of_iterations_lt, number_of_iterations_le, number_of_iterations_cond, number_of_iterations_exit): Use integer_zerop/integer_nonzerop instead of null_or_integer_zerop/nonnull_and_integer_nonzerop. * tree.h (null_or_integer_zerop, nonnull_and_integer_nonzerop): Removed. * tree-scalar-evolution.c (simple_iv): Return zero for step of an invariant. * tree-ssa-loop-ivopts.c (alloc_iv): Do not set step of invariants to zero. (get_iv): Return NULL for non-scalar types. Use zero as a step of an invariant. (determine_biv_step, find_interesting_uses_op, find_interesting_uses_cond, find_interesting_uses_stmt, add_old_ivs_candidates, determine_use_iv_cost_condition, rewrite_use_compare, remove_unused_ivs): Use integer_zerop instead of null_or_integer_zerop. (struct ifs_ivopts_data): Replace step_p field with step field. (idx_find_step): Use zero as a step of an invariant. Modify step instead of *step_p. (find_interesting_uses_address): Use zero as a step of an invariant. Use integer_zerop instead of null_or_integer_zerop. (find_interesting_uses_outside): Call find_interesting_uses_op only for phi nodes for real operands. (add_candidate_1): Expect step to be non-NULL. * tree-ssa-loop-prefetch.c (idx_analyze_ref): Expect step to be non-NULL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120179 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree-ssa-loop-niter.c (zero_p, nonzero_p): Removed.rakdver2006-12-221-86/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | (number_of_iterations_ne, number_of_iterations_lt_to_ne, assert_no_overflow_lt, assert_loop_rolls_lt, number_of_iterations_lt, number_of_iterations_le, number_of_iterations_cond, tree_simplify_using_condition_1, number_of_iterations_exit, find_loop_niter, loop_niter_by_eval, implies_nonnegative_p, implies_ge_p, record_nonwrapping_iv, idx_infer_loop_bounds, n_of_executions_at_most, scev_probably_wraps_p): Do not use zero_p/nonzero_p. * tree-ssa-loop-manip.c (determine_exit_conditions): Ditto. * tree-ssa-loop-ivopts.c (niter_for_exit, determine_biv_step, find_interesting_uses_op, find_interesting_uses_cond, find_interesting_uses_address, find_interesting_uses_stmt, strip_offset_1, add_candidate_1, add_old_ivs_candidates, difference_cost, determine_use_iv_cost_condition, rewrite_use_compare, remove_unused_ivs): Ditto. * tree-ssa-address.c (tree_mem_ref_addr, create_mem_ref_raw): Ditto. * tree-ssa-loop-prefetch.c (idx_analyze_ref): Ditto. * tree-cfg.c (find_taken_edge_cond_expr): Ditto. * tree.h (zero_p): Declaration removed. (null_or_integer_zerop, nonnull_and_integer_nonzerop): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120156 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree-vrp.c (adjust_range_with_scev): Use get_chrec_loop.rakdver2006-12-101-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119713 138bc75d-0d04-0410-961f-82ee72b054a4
* Merge gimple-tuples-branch into mainline.aldyh2006-12-051-13/+14
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119546 138bc75d-0d04-0410-961f-82ee72b054a4
* * builtins.c, cfgloop.h, cgraph.h, config/arm/arm.c,kazu2006-12-021-2/+2
| | | | | | | | | | | | | | | | | config/i386/i386.c, config/i386/i386.h, config/mips/mips.h, config/rs6000/cell.md, config/rs6000/rs6000.c, config/sh/sh.c, config/sh/sh4-300.md, config/spu/spu-builtins.def, config/spu/spu-c.c, config/spu/spu-modes.def, config/spu/spu.c, config/spu/spu.md, config/spu/spu_internals.h, config/spu/vmx2spu.h, fold-const.c, fwprop.c, predict.c, tree-data-ref.h, tree-flow.h, tree-ssa-loop-manip.c, tree-ssa-loop-niter.c, tree-ssa-pre.c, tree-vect-analyze.c, tree-vect-transform.c, tree-vectorizer.c, tree-vrp.c: Fix comment typos. Follow spelling conventions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119442 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree-vrp.c (execute_vrp): Do not pass loops structure throughrakdver2006-11-251-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119189 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree-loop-linear.c (linear_transform_loops): Use single_exit accessorrakdver2006-11-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119075 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree-ssa-loop-im.c (schedule_sm, determine_lsm_ref,rakdver2006-11-211-17/+16
| | | | | | | | | | | | | | | | | | | hoist_memory_references, loop_suitable_for_sm, determine_lsm_loop): Use vector of edges instead of array. * tree-ssa-loop-niter.c (find_loop_niter, find_loop_niter_by_eval, estimate_numbers_of_iterations_loop): Ditto. * predict.c (predict_loops): Ditto. * loop-unroll.c (analyze_insns_in_loop): Ditto. * tree-ssa-threadupdate.c: Remove declaration of heap allocation for edge vectors. * basic-block.h: Declare heap allocation for edge vectors. * tree-outof-ssa.c: Ditto. * cfgloop.c (get_loop_exit_edges): Return vector of edges. * cfgloop.h (get_loop_exit_edges): Declaration changed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119039 138bc75d-0d04-0410-961f-82ee72b054a4
* * Makefile.in (tree-data-ref.o): Add langhooks.h dependency.rakdver2006-11-121-139/+326
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tree-ssa-loop-niter.c (derive_constant_upper_bound): Follow ud-chains. Handle AND_EXPR. (record_estimate): Record whether the estimate is realistic and whether it is derived from a loop exit. (record_nonwrapping_iv, idx_infer_loop_bounds, infer_loop_bounds_from_ref, infer_loop_bounds_from_array, infer_loop_bounds_from_signedness): New functions. (compute_estimated_nb_iterations): Take only realistic bounds into account. Set estimate_state. Use double_ints. (infer_loop_bounds_from_undefined): Call infer_loop_bounds_from_array and infer_loop_bounds_from_signedness. Do not consider basic blocks that do not have to be always executed. (estimate_numbers_of_iterations_loop): Set estimate_state, and use it to determine whether to call infer_loop_bounds_from_undefined and compute_estimated_nb_iterations. (n_of_executions_at_most): Use double_ints. (free_numbers_of_iterations_estimates_loop): Set estimate_state. (substitute_in_loop_info): Do not replace in estimated_nb_iterations. * double-int.c (double_int_to_tree): Improve comment. (double_int_fits_to_tree_p): New function. * double-int.h (double_int_fits_to_tree_p): Declare. * tree-data-ref.c: Include langhooks.h. (estimate_niter_from_size_of_data, estimate_iters_using_array): Removed. (analyze_array_indexes): Do not call estimate_niter_from_size_of_data. (analyze_array): Do not pass estimate_only argument to analyze_array_indexes. (get_number_of_iters_for_loop): Build tree from the stored double_int value. (get_references_in_stmt, find_data_references_in_stmt): New functions. (find_data_references_in_loop): Use find_data_references_in_stmt. * tree-data-ref.h (struct data_ref_loc_d): New. (get_references_in_stmt): Declare. (estimate_iters_using_array): Declaration removed. * cfgloop.h (struct nb_iter_bound): Change type of bound to double_int. Improve comments. Add is_exit and realistic fields. (struct loop): Changed type of estimated_nb_iterations to double_int. Added estimate_state field. (record_estimate): Declaration removed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118729 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree-ssa-loop-niter.c (scev_probably_wraps_p): Fix typo in argument name.rakdver2006-07-061-2/+2
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115233 138bc75d-0d04-0410-961f-82ee72b054a4
* 2006-06-21 Richrad Guenther <rguenther@suse.de>rguenth2006-06-211-2/+12
| | | | | | | | * tree-ssa-loop-niter.c (simplify_using_initial_conditions): Limit iteration over the dominators. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114840 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree-ssa-loop-niter.c (implies_ge_p): New function.rakdver2006-06-191-2/+41
| | | | | | | | | (derive_constant_upper_bound): Handle OP0 - CST in unsigned types correctly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114782 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree-ssa-loop-niter.c (implies_nonnegative_p): New function.rakdver2006-06-151-12/+129
| | | | | | | | | | | | | | (derive_constant_upper_bound): Derive more precise upper bound in common cases. Return type changed to double_int. (record_estimate): Reflect the changed return type of derive_constant_upper_bound. * double-int.c (double_int_zext, double_int_sext): Fix. * gcc.dg/tree-ssa/loop-18.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114674 138bc75d-0d04-0410-961f-82ee72b054a4
* PR tree-optimization/27639rakdver2006-05-241-304/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | PR tree-optimization/26719 * tree-vrp.c (adjust_range_with_scev): Use scev_direction and adjust call to scev_probably_wraps_p. * tree-ssa-loop-niter.c (compare_trees, convert_step_widening, used_in_pointer_arithmetic_p, convert_step): Removed. (nowrap_type_p): New function. (scev_probably_wraps_p): Rewritten. * tree-scalar-evolution.c (instantiate_parameters_1): Do not call chrec_convert if chrec_convert_aggressive might have been used. * tree-chrec.c (convert_affine_scev, chrec_convert_1, scev_direction): New functions. (chrec_convert): Changed to a wrapper over chrec_convert_1. * tree-ssa-loop-ivopts.c (idx_find_step): Use convert_affine_scev instead of convert_step. * tree-flow.h (scev_probably_wraps_p): Declaration changed. (convert_step): Declaration removed. (convert_affine_scev, nowrap_type_p, scev_direction): Declare. * gcc.dg/pr27639.c: New test. * gcc.dg/pr26719.c: New test. * gcc.dg/tree-ssa/scev-cast.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114057 138bc75d-0d04-0410-961f-82ee72b054a4
* 2006-05-15 Richard Guenther <rguenther@suse.de>rguenth2006-05-151-13/+15
| | | | | | | | | | | PR tree-optimization/27603 * tree-ssa-loop-niter.c (infer_loop_bounds_from_undefined): Do computations in original type. * gcc.dg/torture/pr27603.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113797 138bc75d-0d04-0410-961f-82ee72b054a4
* 2006-05-07 Richard Guenther <rguenther@suse.de>rguenth2006-05-071-2/+8
| | | | | | | | | | | | | PR tree-optimization/27136 * tree-ssa-loop-niter.c (get_val_for): Correct function comment, assert requirements. (loop_niter_by_eval): Stop processing if the iterated value did not simplify. * gcc.dg/torture/pr27136.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113601 138bc75d-0d04-0410-961f-82ee72b054a4
* Fix mistake in my previous commit (n_of_executions_at_least should berakdver2006-05-021-5/+5
| | | | | | | | named n_of_executions_at_most). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113461 138bc75d-0d04-0410-961f-82ee72b054a4
* PR tree-optimization/27144rakdver2006-05-011-71/+54
| | | | | | | | | | | | | | | | | | | | * tree-ssa-loop-niter.c (derive_constant_upper_bound): New function. (record_estimate): Only record constant upper bound. (infer_loop_bounds_from_undefined): Call compute_estimated_nb_iterations just once. (proved_non_wrapping_p): Renamed to ... (n_of_executions_at_most): ... this. Expect bound to be a constant. (convert_step_widening, scev_probably_wraps_p): Call n_of_executions_at_most instead of proved_non_wrapping_p. (substitute_in_loop_info): Do not replace values in bounds. * cfgloop.h (struct nb_iter_bound): Remove "additional" field. Update comments. * gcc.dg/tree-ssa/loop-16.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113425 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree-ssa-loop-niter.c (inverse, number_of_iterations_ne,spop2006-04-071-13/+13
| | | | | | | | | | | | | | | | | assert_no_overflow_lt, assert_loop_rolls_lt, number_of_iterations_lt, number_of_iterations_le, number_of_iterations_cond, find_loop_niter, estimate_numbers_of_iterations_loop): Use build_int_cst instead of build_int_cst_type. * tree-chrec.c (chrec_fold_multiply_poly_poly, chrec_fold_multiply): Same. * tree-ssa-loop-ivopts.c (strip_offset_1, force_expr_to_var_cost, force_expr_to_var_cost): Same. * tree-mudflap.c (mf_xform_derefs_1): Same. * tree-ssa-loop-prefetch.c (idx_analyze_ref): Same. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112755 138bc75d-0d04-0410-961f-82ee72b054a4
* PR tree-optimization/26859spop2006-03-291-6/+20
| | | | | | | | | | | * tree-ssa-loop-niter.c (infer_loop_bounds_from_undefined): Avoid division by zero. (convert_step): Remove TREE_OVERFLOW and TREE_CONSTANT_OVERFLOW flags for the step after fold_convert. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112502 138bc75d-0d04-0410-961f-82ee72b054a4
* PR tree-optimization/25985rakdver2006-03-291-8/+63
| | | | | | | | | | | | | | | * tree-ssa-loop-niter.c (number_of_iterations_le, number_of_iterations_ne): Make comments more precise. (number_of_iterations_cond): Add only_exit argument. Use the fact that signed variables do not overflow only when only_exit is true. (loop_only_exit_p): New. (number_of_iterations_exit): Pass result of loop_only_exit_p to number_of_iterations_cond. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112484 138bc75d-0d04-0410-961f-82ee72b054a4
* * builtins.c, c-pragma.h, c-typeck.c, cgraph.c, cgraphunit.c,kazu2006-03-041-1/+1
| | | | | | | | | | | | | | | | | combine.c, common.opt, config/dfp-bit.c, config/i386/i386.c, config/m68k/m68k.c, config/m68k/m68k.md, config/mt/mt.c, config/mt/mt.h, config/s390/s390.md, df-core.c, df-problems.c, df-scan.c, df.h, diagnostic.c, expr.c, function.h, gimplify.c, loop-invariant.c, omp-low.c, opts.c, passes.c, rtl-factoring.c, rtlanal.c, struct-equiv.c, tree-cfgcleanup.c, tree-ssa-loop-niter.c, tree-ssa-loop-prefetch.c, tree-ssa-structalias.c, tree-ssa-threadedge.c, tree-ssa-threadupdate.c, tree-vect-patterns.c, tree-vect-transform.c, tree-vectorizer.h, tree-vrp.c, unwind-dw2.c: Fix comment typos. Follow spelling conventions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111721 138bc75d-0d04-0410-961f-82ee72b054a4
* * doc/invoke.texi (-fprefetch-loop-arrays, -fprefetch-loop-arrays-rtl):rakdver2006-02-141-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Document. * tree-ssa-loop-niter.c (number_of_iterations_ne, number_of_iterations_lt, number_of_iterations_cond): Remember the shape of the ending condition. * tree-ssa-loop-manip.c: Include params.h. (build_if_stmt, can_unroll_loop_p, determine_exit_conditions, tree_unroll_loop): New functions. * tree-pass.h (pass_loop_prefetch): Declare. * loop.c (rest_of_handle_loop_optimize): Test for -fprefetch-loop-arrays-rtl. * tree-scalar-evolution.h (affine_iv): Moved to tree-flow.h. * timevar.def (TV_TREE_PREFETCH): New timevar. * tree-ssa-loop.c (tree_ssa_loop_prefetch, gate_tree_ssa_loop_prefetch, pass_loop_prefetch): New. * tree-cfgcleanup.c: Include tree-scalar-evolution.h. (cleanup_tree_cfg_loop): Call scev_reset. * common.opt (fprefetch-loop-arrays-rtl): Add. * tree-ssa-loop-prefetch.c: New file. * tree-outof-ssa.c (struct value_expr_d): Add expr_vars field. (new_temp_expr_table): Initialize expr_vars. (free_temp_expr_table): Cleanup expr_vars. (check_replaceable, find_replaceable_in_bb): Prevent accumulating expressions from being merged into one. * tree-flow.h (affine_iv): Moved from tree-scalar-evolution.h. (struct tree_niter_desc): Add control, bound and cmp fields. (tree_ssa_prefetch_arrays, can_unroll_loop_p, tree_unroll_loop): Declare. * Makefile.in (tree-ssa-loop-prefetch.o): Add. (tree-cfgcleanup.o): Add SCEV_H dependency. (tree-ssa-loop-manip.o): Add PARAMS_H dependency. * passes.c (init_optimization_passes): Add pass_loop_prefetch. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110964 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree-ssa-loop-niter.c (number_of_iterations_cond): Split into severalrakdver2006-01-141-419/+425
| | | | | | | | | | | | | | | | | functions. (number_of_iterations_ne, number_of_iterations_lt_to_ne, assert_no_overflow_lt, assert_loop_rolls_lt, number_of_iterations_lt, number_of_iterations_le): New functions. (number_of_iterations_special): Removed. (number_of_iterations_exit): Do not use number_of_iterations_special. * tree.c (unsigned_type_for): Always return integer type. * gcc.dg/tree-ssa/pr19210-1.c: Update outcome. Add new test loop. * gcc.dg/tree-ssa/pr19210-2.c: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109702 138bc75d-0d04-0410-961f-82ee72b054a4
* PR tree-optimization/18527rakdver2006-01-061-125/+147
| | | | | | | | | | | | | | | | | | | | | | | | | * tree-ssa-loop-niter.c (number_of_iterations_cond, number_of_iterations_special, number_of_iterations_exit): Move base and step of an iv to a single structure. Add no_overflow flag, and use it in # of iterations analysis. * tree-scalar-evolution.c (analyze_scalar_evolution_in_loop): Add folded_casts argument. (simple_iv): Pass base and step in a structure. Set no_overflow flag. (scev_const_prop): Add argument to analyze_scalar_evolution_in_loop. Evaluate expensiveness of computing # of iterations instead of the final expression. * tree-scalar-evolution.h (affine_iv): New structure. (simple_iv): Declaration changed. * tree-chrec.c (chrec_apply): Handle chrecs containing symbols. * tree-ssa-loop-ivopts.c (determine_biv_step, find_givs_in_stmt_scev, find_givs_in_stmt): Changed due to simple_iv change. * gcc.dg/tree-ssa/loop-15.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109427 138bc75d-0d04-0410-961f-82ee72b054a4
* 2005-11-04 Richard Guenther <rguenther@suse.de>rguenth2005-11-041-3/+3
| | | | | | | | | | | | | | | | * tree-flow.h (ref_contains_indirect_ref): Rename to array_ref_contains_indirect_ref. * tree-flow-inline.h (ref_contains_indirect_ref): Likewise. (array_ref_contains_indirect_ref): Make comment match the code and vice-versa. (ref_contains_array_ref): Likewise. * tree-ssa-structalias.c (find_func_aliases): Remove call to ref_contains_indirect_ref. * tree-ssa-loop-niter.c (infer_loop_bounds_from_undefined): Rename calls to ref_contains_indirect_ref. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106499 138bc75d-0d04-0410-961f-82ee72b054a4
* PR tree-optimization/24226rakdver2005-10-091-2/+4
| | | | | | | | | | * tree-cfg.c (remove_bb): Clean up unreachable loops. * tree-flow.h (free_numbers_of_iterations_estimates_loop): Declare. * tree-ssa-loop-niter.c (free_numbers_of_iterations_estimates_loop): Export. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105151 138bc75d-0d04-0410-961f-82ee72b054a4
* Add missing part of committed patch from 21stdberlin2005-09-271-3/+6
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104696 138bc75d-0d04-0410-961f-82ee72b054a4
* PR tree-optimization/23929jakub2005-09-201-1/+5
| | | | | | | | | | * tree-ssa-loop-niter.c (expand_simple_operations): Return immediately if expr is NULL. * gcc.c-torture/compile/pr23929.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104461 138bc75d-0d04-0410-961f-82ee72b054a4
* 2005-09-15 Daniel Berlin <dberlin@dberlin.org>dberlin2005-09-151-3/+3
| | | | | | | | | | | | | * tree-data-ref.c (analyze_array_indexes): Add estimate_only parameter. Update callers. (estimate_iters_using_array): New function. * tree-data-ref.h (estimate_iters_using_array): Prototype * tree-ssa-loop-niter.c (infer_loop_bounds_from_undefined): Use estimate_iters_using_array instead of analyze_array. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104312 138bc75d-0d04-0410-961f-82ee72b054a4
* * Makefile.in (tree-chrec.o): Depends on SCEV_H.spop2005-09-091-2/+10
| | | | | | | | | | | | | | | | | | | * tree-chrec.c: Include tree-scalar-evolution.h. (chrec_convert): Instantiate the base and step before calling scev_probably_wraps_p that would fail on parametric evolutions. Collect all the fails into a single section failed_to_convert, print a diagnostic, and return chrec_dont_know instead of calling fold_convert. * tree-scalar-evolution.c (loop_closed_phi_def): New. (instantiate_parameters_1): Avoid instantiation of loop closed ssa phi nodes. (scev_const_prop): Don't replace the definition of a loop closed ssa phi node by itself, or by another loop closed ssa phi node. * tree-ssa-loop-niter.c (scev_probably_wraps_p, convert_step): Check that base and step are defined. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104092 138bc75d-0d04-0410-961f-82ee72b054a4
* PR tree-optimization/23410spop2005-09-011-2/+13
| | | | | | | | * tree-ssa-loop-niter.c (scev_probably_wraps_p): Check that the sequence is not wrapping during the first step. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103733 138bc75d-0d04-0410-961f-82ee72b054a4
* PR tree-optimization/23511spop2005-08-231-1/+3
| | | | | | | | * tree-ssa-loop-niter.c (infer_loop_bounds_from_undefined): Don't handle cases where TYPE_MIN_VALUE or TYPE_MAX_VALUE are NULL_TREE. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103391 138bc75d-0d04-0410-961f-82ee72b054a4
* PR tree-optimization/23434spop2005-08-211-0/+4
| | | | | | | | * tree-ssa-loop-niter.c (proved_non_wrapping_p): Give up when the iteration bound is not an INTEGER_CST. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103315 138bc75d-0d04-0410-961f-82ee72b054a4
* 2005-08-16 James A. Morrison <phython@gcc.gnu.org>phython2005-08-171-9/+9
| | | | | | | | | | | | | | | | | | | * fold-const.c (optimize_bit_field_compare): Remove extra fold call. (try_move_mult_to_index): Call fold_build2 instead of build2. (fold_binary): Don't call fold after calls to try_move_mult_to_index. * tree-ssa-loop-niter.c (inverse): Call int_const_binop instead of fold_binary_to_constant. (infer_loop_bounds_from_undefined): Call fold_build2 instead of fold (build. * tree-data-ref.c (tree_fold_divides_p): Use tree_int_cst_equal to check if A == gcd (A, B). Remove TYPE argument. (analyze_offset) Use fold_build2 instead of fold (build. (create_data_ref): Likewise. (analyze_siv_subscript_cst_affine): Update calls to tree_fold_divides_p. * tree-ssa-ccp.c (widen_bitfield): Call fold_build2 instead of build2 then fold. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103200 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree-ssa-loop-niter.c (scev_probably_wraps_p): Reword a comment.spop2005-08-161-8/+13
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103152 138bc75d-0d04-0410-961f-82ee72b054a4
* PR tree-optimization/22236spop2005-08-131-14/+214
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103055 138bc75d-0d04-0410-961f-82ee72b054a4
* 2005-08-09 James A. Morrison <phython@gcc.gnu.org>phython2005-08-091-12/+14
| | | | | | | | | | | | * tree-ssa-loop-niter.c (tree_simplify_using_condition_1): Use fold_binary instead of fold_build2 since we don't care about the resulting tree. (loop_niter_by_eval): Likewise. (compare_trees): Likewise. (proved_non_wrapping_p): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102897 138bc75d-0d04-0410-961f-82ee72b054a4
* PR tree-optimize/22348rakdver2005-07-271-1/+1
| | | | | | | | | | * tree-ssa-loop-niter.c (number_of_iterations_cond): Fold the partial computation. * gcc.c-torture/execute/pr22348.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102427 138bc75d-0d04-0410-961f-82ee72b054a4
* gcc:bonzini2005-07-211-5/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102225 138bc75d-0d04-0410-961f-82ee72b054a4
* PR 21959dnovillo2005-06-281-0/+35
| | | | | | | | | | | | | | * tree-ssa-loop-niter.c (scev_probably_wraps_p): Handle type casts between unsigned and signed types with different size or precision. testsuite/ChangeLog PR 21959 * gcc.dg/tree-ssa/pr21959.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101365 138bc75d-0d04-0410-961f-82ee72b054a4
* Update FSF address.kcook2005-06-251-2/+2
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101317 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree-data-ref.c (compute_estimated_nb_iterations,spop2005-06-081-1/+12
| | | | | | | | | | | | | | | | analyze_array_indexes, compute_overlap_steps_for_affine_1_2, analyze_subscript_affine_affine, find_data_references_in_loop): Fixed to use chrec_contains_undetermined to test the values of loop->estimated_nb_iterations. * tree-ssa-loop-niter.c (estimate_numbers_of_iterations_loop): Compute the estimation only when loop->estimated_nb_iterations has not yet been initialized. (convert_step_widening, scev_probably_wraps_p): Add a call to estimate_numbers_of_iterations_loop. * tree-vrp.c (execute_vrp): Don't call estimate_numbers_of_iterations. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100749 138bc75d-0d04-0410-961f-82ee72b054a4
* Fixes PR 18403 and meta PR 21861.spop2005-06-071-77/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile.in (tree-chrec.o): Depend on CFGLOOP_H and TREE_FLOW_H. * tree-chrec.c: Include cfgloop.h and tree-flow.h. (evolution_function_is_invariant_rec_p, evolution_function_is_invariant_p): New. (chrec_convert): Use an extra parameter AT_STMT for refining the information that is passed down to convert_step. Integrate the code that was in count_ev_in_wider_type. * tree-chrec.h (count_ev_in_wider_type): Removed. (chrec_convert): Modify its declaration. (evolution_function_is_invariant_p): Declared. (evolution_function_is_affine_p): Use evolution_function_is_invariant_p. * tree-flow.h (can_count_iv_in_wider_type): Renamed convert_step. (scev_probably_wraps_p): Declared. * tree-scalar-evolution.c (count_ev_in_wider_type): Removed. (follow_ssa_edge_in_rhs, interpret_rhs_modify_expr): Use an extra parameter AT_STMT for refining the information that is passed down to convert_step. (follow_ssa_edge_inner_loop_phi, follow_ssa_edge, analyze_scalar_evolution_1): Initialize AT_STMT with the current analyzed statement. (instantiate_parameters_1): Don't know yet how to initialize AT_STMT. * tree-ssa-loop-ivopts.c (idx_find_step): Update the use of can_count_iv_in_wider_type to use convert_step. * tree-ssa-loop-niter.c (can_count_iv_in_wider_type_bound): Move code that is independent of the loop over the known iteration bounds to convert_step_widening, the rest is moved to proved_non_wrapping_p. (scev_probably_wraps_p): New. (can_count_iv_in_wider_type): Renamed convert_step. * tree-vrp.c (adjust_range_with_scev): Take an extra AT_STMT parameter. Use scev_probably_wraps_p for computing init_is_max. (vrp_visit_assignment): Pass the current analyzed statement to adjust_range_with_scev. (execute_vrp): Call estimate_numbers_of_iterations for refining the information provided by scev analyzer. testsuite: * testsuite/gcc.dg/vect/vect-77.c: Remove xfail from lp64. * testsuite/gcc.dg/vect/vect-78.c: Same. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100718 138bc75d-0d04-0410-961f-82ee72b054a4
* PR tree-optimization/21846rakdver2005-06-051-0/+18
| | | | | | | | | | | * tree-cfg.c (replace_uses_by): Update information stored at loops. * tree-flow.h (substitute_in_loop_info): Declare. * tree-scalar-evolution.c (initialize_scalar_evolutions_analyzer): Ensure that chrec_dont_know and chrec_known have a type. * tree-ssa-loop-niter.c (substitute_in_loop_info): New function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100631 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree-ssa-loop-ivopts.c (find_bivs, find_givs_in_stmt_scev): Applyrakdver2005-05-171-4/+4
| | | | | | | | | | | | | expand_simple_operations to bases of the ivs. (tree_int_cst_sign_bit): Export. * tree-flow.h (expand_simple_operations): Declare. * tree-ssa-loop-niter.c (number_of_iterations_cond): Use tree_int_cst_sign_bit. (expand_simple_operations): Export. * tree.h (tree_int_cst_sign_bit): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99853 138bc75d-0d04-0410-961f-82ee72b054a4
* 2005-05-03 Andrew MacLeod <amacleod@redhat.com>amacleod2005-05-031-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lambda-code.c (gcc_loop_to_lambda_loop, lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def, stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use generic operand interface. * tree-data-ref.c (find_data_references_in_loop): Use generic interface. * tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use generic operand interface. * tree-flow-inline.h (delink_imm_use, link_imm_use_to_list, link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt, next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use, num_imm_uses): Use ssa_use_operand_t. (get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops, get_v_must_def_ops): Delete. (get_def_from_ptr, get_phi_result_ptr): Get def directly now. (get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr, get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr, get_v_must_def_kill_ptr): Delete. (delink_stmt_imm_use): Move and use new operand interface. (op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init, op_iter_next_tree): Use new operand implementation. (clear_and_done_ssa_iter): New. Initialize a blank operand iterator. (op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator type check. (op_iter_next_mustdef, op_iter_next_maydef, op_iter_next_must_and_may_def): Delete. Replace with... (op_iter_next_maymustdef): New. Combine must and may next operations. (op_iter_init_maydef, op_iter_init_mustdef, op_iter_init_must_and_may_def): Use new interface. (single_ssa_tree_operand ): New. Process single operands only as trees. (single_ssa_use_operand): New. Process single operands only as uses. (single_ssa_def_operand): New. Process single operands only as defs. (zero_ssa_operands): New. Return TRUE if there are zero operands of the specified types. (num_ssa_operands): New. Count the number of specified operands. (compare_ssa_operands_equal): New. Compare two statements' operands. (single_phi_def): New. Return true if PHI has one def of the specified operand type. (op_iter_init_phiuse): New. Initialize the iterator for PHI arguments. (op_iter_init_phidef): New. Initialize the iterator for the PHI def. * tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t. (struct stmt_ann_d): Operands field no longer require GTY(). (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype. * tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, dump_replaceable_exprs, rewrite_trees): Use generic interface. * tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node): Use use_operand_p instead of ssa_imm_use_t *. * tree-pretty-print.c (dump_vops): check if operands are active before dumping virtual operands. * tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS. * tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS. (ccp_fold): Use new interface. (ccp_visit_stmt): Remove unused variables and code. (convert_to_gimple_builtin): Insert statements before calling mark_new_vars_to_rename. * tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS. (copy_prop_visit_cond_stmt): Use generic interface. * tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the annotation in table. (thread_across_edge): Use generic interface. (initialize_hash_element): Initialzie with stmt, not annotation. (eliminate_redundant_computations): Use generic interface. (record_equivalences_from_stmt): Pass stmt, not annotation. (avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic interface. * tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS. * tree-ssa-loop-ivopts.c (find_invariants_stmt, find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use generic operand interface. * tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic interface. * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand Interface. * tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type. (build_defs, build_uses, build_v_may_defs, build_vuses, build_v_must_defs): Change type to struct opbuild_list_d. (ops_active): New. Operands active boolean. (operand_memory, operand_memory_index): New. Operand memory managers. (allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype, allocate_vuse_optype, allocate_v_must_def_optype): Delete. (free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs): Change from functions to static variable list heads. (opbuild_initialize_virtual): New. Initialize a virtual build list. (opbuild_initialize_real): New. Initialize a virtual build list. (opbuild_free): New. Free a build list. (opbuild_num_elems): New. Number of items in a list. (opbuild_append_real): New. Add a real (tree *) operand. (opbuild_append_virtual): New. Add and sort a virtual (tree) operand. (opbuild_first): New. Return first element index in a list. (opbuild_next): New. Return next element in a list. (opbuild_elem_real): New. Return real element. (opbuild_elem_virtual): New. Return virtual element. (opbuild_elem_uid): New. Return UID of virtual element. (opbuild_clear): New. Reset an operand list. (opbuild_remove_elem): New. Remove an element form a list. (ssa_operands_active): New. Return true if operand cache is active. (init_ssa_operands, fini_ssa_operands): Initialize new implementation. (ssa_operand_alloc): New. Allocate memory from an operand chunk. (correct_use_link): Use use_operand_p. (finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs, finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation. (cleanup_v_may_defs): Use new implmentation. (finalize_ssa_stmt_operands, start_ssa_stmt_operands): New implementation. (append_def, append_use, append_v_may_def, append_vuse, append_v_must_def): Call opbuild_append routine instead of using varray. (build_ssa_operands): Simplify to simply use stmt, don't maintain a global parse_old_ops variable. (free_ssa_operands): New implementation. (update_stmt_operands): Move. Change argument to build_ssa_operands. (copy_virtual_operands): Move. New generic implementation. (create_ssa_artficial_load_stmt): Move. New implementation. (swap_tree_operands): Update for new implementation. (get_expr_operands): Add stmt parameter to calls to swap_tree_operands. (add_call_clobber_ops, add_call_read_ops): Initialize opbuild list rather than a varray. (verify_imm_links): Use use_operand_p. (dump_immediate_uses_for): If the immediate use variable is a virtual variable, show the virtual ops in the stmt. * tree-ssa-operands.h (def_operand_p): No longer a structure. (NULL_DEF_OPERAND_P): Now a #define. (def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d, vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete. (def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d, mustdef_optype_d): New. Use Linked list representation. (SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk. (struct ssa_operand_memory_d): New. Allocated Chunk node. (struct stmt_operands_d): Change to new pointers that are not GTY. (STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP, STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP, STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT, SET_V_MUST_DEF_KILL): Delete. (V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT, V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*. (V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT, V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*. (enum ssa_op_iter_type): Operand iterator typechecking values. (struct ssa_operand_iterator_d): Use linked lists of operands. (SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL. (FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND, FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef. (FOR_EACH_PHI_ARG): New. Iterate over PHI arguments. (FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses. (FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs. (SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND, SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New. * tree-ssa-opfinalize.h: New. Function templates for expansion. (FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef, alloc_vuse, and alloc_mustdef. (FINALIZE_FUNC): Expands into finalize_ssa_def_ops, finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops, and finalize_ssa_v_must_def_ops. * tree-ssa-pre.c (add_to_sets): Pass tree to vn_add. (create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass stmt around. (compute_avail): Use generic iterator interface. * tree-ssa-propagate.c (first_vdef): Use generic operand interface. (stmt_makes_single_load, stmt_makes_single_store): Use ZERO_SSA_OPERANDS. * tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS. (statement_sink_location): Use generic interface. * tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface. (delete_tree_ssa): Don't call release_defs. Call release_ssa_name and reset the immediate use link nodes. (stmt_references_memory_p): Use ZERO_SSA_OPERANDS. * tree-ssanames.c (make_ssa_name): Use use_operand_p. * tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS. (eliminate_tail_call): Use generic operand interface. * tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS. (vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic interface. * tree-vect-transform.c (update_vuses_to_preheader): Use generic interface. * tree-vectorizer.c (rename_variables_in_bb): Use generic interface. * tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of vuse_optype. (vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add): Use statement pointer instead of vuse_optype. Use generic interface. * tree-vrp.c (maybe_add_assert_expr): Use generic interface. (stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS. * tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d. (tree_ssa_name, phi_arg_d): Use ssa_use_operand_d. * doc/tree-ssa.texi: Update documentation for operand interface. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99155 138bc75d-0d04-0410-961f-82ee72b054a4
* PR tree-optimization/18316rakdver2005-05-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR tree-optimization/19126 * tree.c (build_int_cst_type): Avoid shift by size of type. * tree-scalar-evolution.c (simple_iv): Add allow_nonconstant_step argument. * tree-scalar-evolution.h (simple_iv): Declaration changed. * tree-ssa-loop-ivopts.c (struct iv_cand): Add depends_on field. (dump_cand): Dump depends_on information. (determine_biv_step): Add argument to simple_iv call. (contains_abnormal_ssa_name_p): Handle case expr == NULL. (find_bivs, find_givs_in_stmt_scev): Do not require step to be a constant. (add_candidate_1): Record depends_on for candidates. (tree_int_cst_sign_bit, constant_multiple_of): New functions. (get_computation_at, get_computation_cost_at, may_eliminate_iv): Handle ivs with nonconstant step. (iv_ca_set_remove_invariants, iv_ca_set_add_invariants): New functions. (iv_ca_set_no_cp, iv_ca_set_cp): Handle cand->depends_on. (create_new_iv): Unshare the step before passing it to create_iv. (free_loop_data): Free cand->depends_on. (build_addr_strip_iref): New function. (find_interesting_uses_address): Use build_addr_strip_iref. (strip_offset_1): Split the recursive part from strip_offset. Strip constant offset component_refs and array_refs. (strip_offset): Split the recursive part to strip_offset_1. (add_address_candidates): Removed. (add_derived_ivs_candidates): Do not use add_address_candidates. (add_iv_value_candidates): Add candidates with stripped constant offset. Consider all candidates with initial value 0 important. (struct affine_tree_combination): New. (aff_combination_const, aff_combination_elt, aff_combination_scale, aff_combination_add_elt, aff_combination_add, tree_to_aff_combination, add_elt_to_tree, aff_combination_to_tree, fold_affine_sum): New functions. (get_computation_at): Use fold_affine_sum. * tree-ssa-loop-manip.c (create_iv): Handle ivs with nonconstant step. * tree-ssa-loop-niter.c (number_of_iterations_exit): Add argument to simple_iv call. * gcc.dg/tree-ssa/loop-8.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99059 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree-ssa-loop-niter.c (tree_simplify_using_condition): Expand simplerakdver2005-04-231-10/+81
| | | | | | | | | | | definitions of ssa names in condition. Split recusive part to ... (tree_simplify_using_condition_1): New function. (expand_simple_operations): New function. * gcc.dg/vect/vect-99.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98635 138bc75d-0d04-0410-961f-82ee72b054a4