aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
AgeCommit message (Collapse)AuthorFilesLines
2012-05-24re PR tree-optimization/53465 (wrong code with -O1 -ftree-vrp)Jakub Jelinek1-4/+13
PR tree-optimization/53465 * tree-vrp.c (extract_range_from_cond_expr): First copy_value_range vr0 into *vr, then vrp_meet that. (vrp_meet): If one vr type is VR_UNDEFINED, ensure the result doesn't have any equivalences. (vrp_visit_phi_node): Call copy_value_range instead of vrp_meet the first time. * gcc.c-torture/execute/pr53465.c: New test. From-SVN: r187827
2012-05-15re PR tree-optimization/53355 (Autovectorization of a simple loop could be ↵Richard Guenther1-0/+35
improved.) 2012-05-15 Richard Guenther <rguenther@suse.de> PR tree-optimization/53355 * tree-vrp.c (extract_range_from_binary_expr_1): Handle LSHIFT_EXPRs by constants. * gcc.dg/tree-ssa/vrp67.c: New testcase. From-SVN: r187535
2012-05-07re PR tree-optimization/53239 (VRP vs named value return opt)Jakub Jelinek1-10/+15
PR tree-optimization/53239 * tree-vrp.c (get_value_range): Set VR of SSA_NAME_IS_DEFAULT_DEF of DECL_BY_REFERENCE RESULT_DECL to nonnull. * g++.dg/opt/vrp3.C: New test. * g++.dg/opt/vrp3-aux.cc: New file. * g++.dg/opt/vrp3.h: New file. From-SVN: r187240
2012-04-25re PR tree-optimization/53058 (Another ice in remove_range_assertions)Jakub Jelinek1-1/+4
PR tree-optimization/53058 * double-int.h (double_int_max_value, double_int_min_value): New prototypes. * double-int.c (double_int_max_value, double_int_min_value): New functions. * tree-vrp.c (register_edge_assert_for_2): Compare mask for LE_EXPR or GT_EXPR with double_int_max_value instead of double_int_mask. * gcc.c-torture/compile/pr53058.c: New test. From-SVN: r186816
2012-04-19re PR middle-end/53031 (gcc.dg/tree-ssa/vrp54.c scan-tree-dump-not vrp1 ↵Richard Guenther1-1/+3
"link_error") 2012-04-19 Richard Guenther <rguenther@suse.de> PR tree-optimization/53031 * tree-vrp.c (adjust_range_with_scev): Revert back to using max_loop_iterations. From-SVN: r186592
2012-04-18cfgloop.h (estimate_numbers_of_iterations_loop): Remove use_undefined_p ↵Richard Guenther1-7/+1
parameter. 2012-04-18 Richard Guenther <rguenther@suse.de> * cfgloop.h (estimate_numbers_of_iterations_loop): Remove use_undefined_p parameter. * tree-flow.h (estimate_numbers_of_iterations): Likewise. * tree-ssa-loop-niter.c (estimate_numbers_of_iterations_loop): Likewise. (estimate_numbers_of_iterations): Likewise. (estimated_loop_iterations): Adjust. (max_loop_iterations): Likewise. (scev_probably_wraps_p): Likewise. * tree-ssa-loop.c (tree_ssa_loop_bounds): Likewise. * tree-vrp.c (adjust_range_with_scev): Use max_stmt_executions, not max_loop_iterations. (execute_vrp): Remove explicit number of iterations estimation. From-SVN: r186562
2012-04-12cfgloop.h (estimated_loop_iterations_int): Ditch 'conservative' parameter.Richard Guenther1-1/+1
2012-04-12 Richard Guenther <rguenther@suse.de> * cfgloop.h (estimated_loop_iterations_int): Ditch 'conservative' parameter. (max_stmt_executions_int): Likewise. (estimated_loop_iterations): Likewise. (max_stmt_executions): Likewise. (max_loop_iterations): Declare. (max_loop_iterations_int): Likewise. (estimated_stmt_executions): Likewise. (estimated_stmt_executions_int): Likewise. * tree-ssa-loop-niter.c (estimated_loop_iterations): Split parts to ... (max_loop_iterations): ... this. (estimated_loop_iterations_int): Split parts to ... (max_loop_iterations_int): ... this. (max_stmt_executions_int): Split parts to ... (estimated_stmt_executions_int): ... this. (max_stmt_executions): Split parts to ... (estimated_stmt_executions): ... this. * graphite-sese-to-poly.c (build_loop_iteration_domains): Adjust. * predict.c (predict_loops): Likewise. * tree-data-ref.c (max_stmt_executions_tree): Likewise. (analyze_siv_subscript_cst_affine): Likewise. (compute_overlap_steps_for_affine_1_2): Likewise. (analyze_subscript_affine_affine): Likewise. (init_omega_for_ddr_1): Likewise. * tree-parloops.c (parallelize_loops): Likewise. * tree-ssa-loop-ivopts.c (avg_loop_niter): Likewise. (may_eliminate_iv): Likewise. * tree-ssa-loop-prefetch.c (determine_loop_nest_reuse): Likewise. (loop_prefetch_arrays): Likewise. * tree-vrp.c (adjust_range_with_scev): Likewise. From-SVN: r186372
2012-03-15re PR tree-optimization/52267 (a&~N where N has all the bits set up till a ↵Jakub Jelinek1-1/+271
specific point can be folded to ((unsigned)a) < N) PR tree-optimization/52267 * tree-vrp.c (masked_increment): New function. (register_edge_assert_for_2): Derive ASSERT_EXPRs from (X & CST1) cmp CST2 tests. * gcc.dg/pr52267.c: New test. * gcc.dg/tree-ssa/vrp65.c: New test. * gcc.dg/tree-ssa/vrp66.c: New test. From-SVN: r185427
2012-03-12re PR tree-optimization/51721 (-Warray-bounds false positives and ↵Jakub Jelinek1-4/+54
inconsistencies) PR tree-optimization/51721 * tree-vrp.c (register_edge_assert_for_2): Add asserts for unsvar if (int) unsvar cmp CST. * gcc.dg/tree-ssa/vrp64.c: New test. From-SVN: r185222
2012-03-12re PR tree-optimization/52533 (ice in remove_range_assertions)Jakub Jelinek1-30/+24
PR tree-optimization/52533 * tree-vrp.c (register_edge_assert_for_2): Use double_int type for mask, only handle shifts by non-zero in-range shift count, for LE_EXPR and GT_EXPR if new_val is maximum, don't add the assertion. * gcc.c-torture/compile/pr52533.c: New test. From-SVN: r185219
2012-03-05re PR tree-optimization/51721 (-Warray-bounds false positives and ↵Jakub Jelinek1-1/+88
inconsistencies) PR tree-optimization/51721 * tree-vrp.c (register_edge_assert_for_2): If comparing lhs of right shift by constant with an integer constant, add ASSERT_EXPRs for the rhs1 of the right shift. * gcc.dg/tree-ssa/vrp63.c: New test. * gcc.dg/pr51721.c: New test. From-SVN: r184927
2012-01-05tree-vrp.c (extract_range_from_binary_expr_1): Remove duplicated condition.Eric Botcazou1-16/+14
* tree-vrp.c (extract_range_from_binary_expr_1): Remove duplicated condition. (extract_range_from_unary_expr_1): Avoid useless computations. From-SVN: r182923
2011-12-01re PR tree-optimization/50802 (FAIL: gcc.c-torture/execute/arith-rand-ll.c ↵Joern Rennecke1-21/+39
execution at -O2 and -Os) PR tree-optimization/50802 * tree-vrp.c (simplify_conversion_using_ranges): Rewrite test considering what happens to ranges during sign changes and/or intermediate narrowing conversions. From-SVN: r181880
2011-11-29re PR tree-optimization/51247 (ICE in set_value_range, at tree-vrp.c:417)Jakub Jelinek1-10/+40
PR tree-optimization/51247 * tree-vrp.c (extract_range_from_assert): For signed 1-bit precision types instead of adding 1 subtract -1 and instead of subtracting 1 add -1 to avoid overflows. * gcc.c-torture/compile/pr51247.c: New test. From-SVN: r181818
2011-10-17re PR tree-optimization/50729 (Silent code gen fault: Value range ↵Richard Guenther1-12/+14
propagation seems to propagate values across narrowing/widening) 2011-10-17 Richard Guenther <rguenther@suse.de> PR tree-optimization/50729 * tree-vrp.c (extract_range_from_unary_expr_1): Remove redundant test. (simplify_conversion_using_ranges): Properly test the intermediate result. * gcc.dg/torture/pr50729.c: New testcase. From-SVN: r180087
2011-10-12re PR middle-end/50189 (Wrong code error in -O2 [-fstrict-enums] compile, ↵Paul Koning1-5/+5
target independent) 2011-10-12 Paul Koning <pkoning@gcc.gnu.org> PR tree-optimization/50189 * tree-vrp.c (extract_range_from_assert): Use the type of the variable, not the limit. * g++.dg/torture/pr50189.C: New testcase. From-SVN: r179857
2011-09-01expr.c (expand_expr_real_2): Move COND_EXPR and VEC_COND_EXPR handling here, ↵Richard Guenther1-5/+5
from ... 2011-08-31 Richard Guenther <rguenther@suse.de> * expr.c (expand_expr_real_2): Move COND_EXPR and VEC_COND_EXPR handling here, from ... (expand_expr_real_1): ... here. * gimple-pretty-print.c (dump_ternary_rhs): Handle COND_EXPR and VEC_COND_EXPR. * gimple.c (gimple_rhs_class_table): Make COND_EXPR and VEC_COND_EXPR a GIMPLE_TERNARY_RHS. * tree-cfg.c (verify_gimple_assign_ternary): Handle COND_EXPR and VEC_COND_EXPR here ... (verify_gimple_assign_single): ... not here. * gimple-fold.c (fold_gimple_assign): Move COND_EXPR folding. * tree-object-size.c (cond_expr_object_size): Adjust. (collect_object_sizes_for): Likewise. * tree-scalar-evolution.c (interpret_expr): Don't handle ternary RHSs. * tree-ssa-forwprop.c (forward_propagate_into_cond): Fix and simplify. (ssa_forward_propagate_and_combine): Adjust. * tree-ssa-loop-im.c (move_computations_stmt): Build the COND_EXPR as ternary. * tree-ssa-threadedge.c (fold_assignment_stmt): Adjust. * tree-vect-loop.c (vect_is_simple_reduction_1): Likewise. * tree-vect-stmt.c (vectorizable_condition): Likewise. * tree-vrp.c (extract_range_from_cond_expr): Likewise. (extract_range_from_assignment): Likewise. From-SVN: r178408
2011-08-16tree-vrp.c (extract_range_from_multiplicative_op_1): New helper factored out ↵Richard Guenther1-149/+211
from ... 2011-08-16 Richard Guenther <rguenther@suse.de> * tree-vrp.c (extract_range_from_multiplicative_op_1): New helper factored out from ... (extract_range_from_binary_expr_1): ... here. Re-structure to not glob handling too different tree codes. From-SVN: r177781
2011-08-15tree-vrp.c (value_range_nonnegative_p): Fix anti-range case.Richard Guenther1-121/+72
2011-08-15 Richard Guenther <rguenther@suse.de> * tree-vrp.c (value_range_nonnegative_p): Fix anti-range case. (extract_range_from_unary_expr_1): Restructure. From-SVN: r177761
2011-08-12tree-vrp.c (extract_range_from_unary_expr_1): Implement -X as 0 - X.Richard Biener1-60/+7
2011-08-12 Richard Guenther <rguenther@suse.de> * tree-vrp.c (extract_range_from_unary_expr_1): Implement -X as 0 - X. From-SVN: r177693
2011-08-11lto-cgraph.c (input_node): Use DECL_BUILT_IN.Richard Guenther1-2/+2
2011-08-11 Richard Guenther <rguenther@suse.de> * lto-cgraph.c (input_node): Use DECL_BUILT_IN. * tree-vrp.c (stmt_interesting_for_vrp): Likewise. (vrp_visit_stmt): Likewise. From-SVN: r177668
2011-08-09tree-vrp.c (zero_nonzero_bits_from_vr): Also return precise information for ↵Richard Guenther1-72/+83
ranges with only negative values. 2011-08-09 Richard Guenther <rguenther@suse.de> * tree-vrp.c (zero_nonzero_bits_from_vr): Also return precise information for ranges with only negative values. (extract_range_from_binary_expr_1): Adjust BIT_IOR_EXPR and BIT_AND_EXPR handling to handle ranges with negative values. * gcc.dg/tree-ssa/vrp57.c: Disable CCP. * gcc.dg/tree-ssa/vrp60.c: New testcase. * gcc.dg/tree-ssa/vrp61.c: Likewise. * gcc.dg/tree-ssa/vrp62.c: Likewise. From-SVN: r177597
2011-08-08tree-vrp.c (extract_range_from_unary_expr_1): New function, split out from ...Richard Guenther1-46/+53
2011-08-08 Richard Guenther <rguenther@suse.de> * tree-vrp.c (extract_range_from_unary_expr_1): New function, split out from ... (extract_range_from_unary_expr): ... here. Handle BIT_NOT_EXPR by composition. From-SVN: r177558
2011-08-05re PR tree-optimization/49984 (VRP does not handle BIT_XOR_EXPR)Richard Guenther1-2/+32
2011-08-05 Richard Guenther <rguenther@suse.de> PR tree-optimization/49984 * tree-vrp.c (extract_range_from_binary_expr_1): Handle BIT_XOR_EXPR. * gcc.dg/tree-ssa/vrp59.c: New testcase. From-SVN: r177425
2011-08-05tree-vrp.c (zero_nonzero_bits_from_vr): Make sure to always return true for ↵Richard Guenther1-67/+25
constant integer ranges. 2011-08-05 Richard Guenther <rguenther@suse.de> * tree-vrp.c (zero_nonzero_bits_from_vr): Make sure to always return true for constant integer ranges. (extract_range_from_binary_expr_1): Simplify BIT_AND_EXPR and BIT_IOR_EXPR handling. * gcc.dg/tree-ssa/vrp51.c: Disable CCP. * gcc.dg/tree-ssa/vrp52.c: Likewise. * gcc.dg/tree-ssa/vrp53.c: Likewise. From-SVN: r177423
2011-08-04tree-vrp.c (vrp_expr_computes_nonnegative): Remove.Richard Guenther1-95/+89
2011-08-04 Richard Guenther <rguenther@suse.de> * tree-vrp.c (vrp_expr_computes_nonnegative): Remove. (value_range_nonnegative_p): New function. (ssa_name_nonnegative_p): Use it. (value_range_constant_singleton): New function. (op_with_constant_singleton_value_range): Use it. (extract_range_from_binary_expr_1): New function, split out from ... (extract_range_from_binary_expr): ... this. Remove fallback constant folding done here. From-SVN: r177393
2011-08-04re PR middle-end/49806 (FAIL: gcc.dg/tree-ssa/vrp47.c)Richard Guenther1-90/+61
2011-08-04 Richard Guenther <rguenther@suse.de> PR tree-optimization/49806 * tree-vrp.c (op_with_boolean_value_range_p): New function. (simplify_truth_ops_using_ranges): Simplify. Allow inserting a new statement for a final conversion to bool. From-SVN: r177392
2011-07-29tree-vrp.c (get_value_range): Only set parameter default definitions to ↵Richard Guenther1-7/+18
varying, leave others at undefined. 2011-07-29 Richard Guenther <rguenther@suse.de> * tree-vrp.c (get_value_range): Only set parameter default definitions to varying, leave others at undefined. (extract_range_from_binary_expr): Fix undefined handling. (vrp_visit_phi_node): Handle merged undefined state. * gcc.dg/uninit-suppress.c: Also disable VRP. * gcc.dg/uninit-suppress_2.c: Likewise. From-SVN: r176918
2011-07-28tree-vrp.c (simplify_stmt_using_ranges): Remove TRUTH_NOT_EXPR case.Kai Tietz1-50/+33
2011-07-28 Kai Tietz <ktietz@redhat.com> * tree-vrp.c (simplify_stmt_using_ranges): Remove TRUTH_NOT_EXPR case. (simplify_truth_ops_using_ranges): Likewise. (build_assert_expr_for): Likewise. (build_assert_expr_for_1): Remove TRUTH_NOT_EXPR case and handle BIT_NOT_EXPR for truth-operation. From-SVN: r176866
2011-07-27tree-vrp.c (extract_range_from_binary_expr): Remove TRUTH-binary cases and ↵Kai Tietz1-96/+60
add new bitwise-cases. 2011-07-27 Kai Tietz <ktietz@redhat.com> * tree-vrp.c (extract_range_from_binary_expr): Remove TRUTH-binary cases and add new bitwise-cases. (extract_range_from_assignment): Likewise. (register_edge_assert_for_1): Likeiwise. (register_edge_assert_for): Likewise. (simplify_truth_ops_using_ranges): Likewise. (simplify_stmt_using_ranges): Likewise. From-SVN: r176818
2011-07-26re PR middle-end/49840 (New test failures)Richard Guenther1-2/+24
2011-07-26 Richard Guenther <rguenther@suse.de> PR tree-optimization/49840 * tree-vrp.c (range_fits_type_p): Properly handle full double-int precision. From-SVN: r176790
2011-07-25re PR tree-optimization/49715 (Could do more efficient unsigned-to-float to ↵Richard Guenther1-0/+101
conversions based on range information) 2011-07-25 Richard Guenther <rguenther@suse.de> PR tree-optimization/49715 * tree-vrp.c: Include expr.h and optabs.h. (range_fits_type_): New function. (simplify_float_conversion_using_ranges): Likewise. (simplify_stmt_using_ranges): Call it. * Makefile.in (tree-vrp.o): Add $(EXPR_H) and $(OPTABS_H) dependencies. * optabs.c (can_float_p): Export. * optabs.h (can_float_p): Declare. * gcc.target/i386/pr49715-1.c: New testcase. * gcc.target/i386/pr49715-2.c: Likewise. From-SVN: r176735
2011-07-25tree-vrp.c (num_vr_values, [...]): New global vars.Richard Guenther1-5/+22
2011-07-25 Richard Guenther <rguenther@suse.de> * tree-vrp.c (num_vr_values, values_propagated): New global vars. (get_value_range): For out-of-range SSA names or names created after propagation return a read-only varying range. (dump_all_value_ranges): Adjust. (vrp_initialize): Likewise. (vrp_finalize): Likewise. From-SVN: r176734
2011-07-19tree.h (fold_build_pointer_plus_loc): New helper function.Richard Guenther1-5/+2
2011-07-19 Richard Guenther <rguenther@suse.de> * tree.h (fold_build_pointer_plus_loc): New helper function. (fold_build_pointer_plus_hwi_loc): Likewise. (fold_build_pointer_plus): Define. (fold_build_pointer_plus_hwi): Likewise. * builtins.c (std_gimplify_va_arg_expr): Use fold_build_pointer_plus. (fold_builtin_memory_op): Likewise. (fold_builtin_stpcpy): Likewise. (fold_builtin_memchr): Likewise. (fold_builtin_strstr): Likewise. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (expand_builtin_memory_chk): Likewise. (fold_builtin_memory_chk): Likewise. * c-typeck.c (build_unary_op): Likewise. * cgraphunit.c (thunk_adjust): Likewise. * fold-const.c (build_range_check): Likewise. (fold_binary_loc): Likewise. * omp-low.c (extract_omp_for_data): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_for_static_chunk): Likewise. * tree-affine.c (add_elt_to_tree): Likewise. * tree-data-ref.c (split_constant_offset_1): Likewise. * tree-loop-distribution.c (generate_memset_zero): Likewise. * tree-mudflap.c (mf_xform_derefs_1): Likewise. * tree-predcom.c (ref_at_iteration): Likewise. * tree-ssa-address.c (tree_mem_ref_addr): Likewise. (add_to_parts): Likewise. (create_mem_ref): Likewise. * tree-ssa-loop-ivopts.c (force_expr_to_var_cost): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_lt_to_ne): Likewise. (number_of_iterations_le): Likewise. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Likewise. * tree-vect-data-refs.c (vect_analyze_data_refs): Likewise. (vect_create_addr_base_for_vector_ref): Likewise. * tree-vect-loop-manip.c (vect_update_ivs_after_vectorizer): Likewise. (vect_create_cond_for_alias_checks): Likewise. * tree-vrp.c (extract_range_from_assert): Likewise. * config/alpha/alpha.c (alpha_va_start): Likewise. (alpha_gimplify_va_arg_1): Likewise. * config/i386/i386.c (ix86_va_start): Likewise. (ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mep/mep.c (mep_expand_va_start): Likewise. (mep_gimplify_va_arg_expr): Likewise. * config/mips/mips.c (mips_va_start): Likewise. (mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start): Likewise. (rs6000_gimplify_va_arg): Likewise. * config/s390/s390.c (s390_va_start): Likewise. (s390_gimplify_va_arg): Likewise. * config/sh/sh.c (sh_va_start): Likewise. (sh_gimplify_va_arg_expr): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Likewise. * config/spu/spu.c (spu_va_start): Likewise. (spu_gimplify_va_arg_expr): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. (xstormy16_gimplify_va_arg_expr): Likewise. * config/xtensa/xtensa.c (xtensa_va_start): Likewise. (xtensa_gimplify_va_arg_expr): Likewise. c-family/ * c-common.c (pointer_int_sum): Use fold_build_pointer_plus. * c-omp.c (c_finish_omp_for): Likewise. cp/ * call.c (build_special_member_call): Use fold_build_pointer_plus. * class.c (build_base_path): Likewise. (convert_to_base_statically): Likewise. (dfs_accumulate_vtbl_inits): Likewise. * cp-gimplify.c (cxx_omp_clause_apply_fn): Likewise. * except.c (expand_start_catch_block): Likewise. * init.c (expand_virtual_init): Likewise. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (build_vec_delete): Likewise. * rtti.c (build_headof): Likewise. (tinfo_base_init): Likewise. * typeck.c (get_member_function_from_ptrfunc): Likewise. (cp_build_addr_expr_1): Likewise. * typeck2.c (build_m_component_ref): Likewise. fortran/ * trans-expr.c (fill_with_spaces): Use fold_build_pointer_plus. (gfc_trans_string_copy): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_repeat): Likewise. * trans-types.c (gfc_get_array_descr_info): Likewise. * trans.c (gfc_build_array_ref): Likewise. java/ * builtins.c (static): Use fold_build_pointer_plus. * class.c (make_class_data): Likewise. (build_symbol_entry): Likewise. * except.c (build_exception_object_ref): Likewise. * expr.c (build_java_arrayaccess): Likewise. (build_field_ref): Likewise. (build_known_method_ref): Likewise. (build_invokevirtual): Likewise. objc/ * objc-next-runtime-abi-02.c (objc_v2_build_ivar_ref): Use fold_build_pointer_plus. (objc2_build_ehtype_initializer): Likewise. From-SVN: r176461
2011-07-13tree-vrp.c (simplify_conversion_using_ranges): Make sure the final type is ↵Richard Guenther1-0/+2
integral. 2011-07-13 Richard Guenther <rguenther@suse.de> * tree-vrp.c (simplify_conversion_using_ranges): Make sure the final type is integral. * gcc.dg/torture/20110713-1.c: New testcase. From-SVN: r176227
2011-07-11tree-vrp.c (simplify_conversion_using_ranges): Manually translate the source ↵Richard Guenther1-18/+43
value-range through the conversion chain. 2011-07-11 Richard Guenther <rguenther@suse.de> * tree-vrp.c (simplify_conversion_using_ranges): Manually translate the source value-range through the conversion chain. From-SVN: r176154
2011-07-07tree-vrp.c (simplify_conversion_using_ranges): New function.Richard Guenther1-5/+45
2011-07-07 Richard Guenther <rguenther@suse.de> * tree-vrp.c (simplify_conversion_using_ranges): New function. (simplify_stmt_using_ranges): Call it. * gcc.dg/tree-ssa/vrp58.c: New testcase. * gcc.dg/tree-ssa/scev-cast.c: Adjust. From-SVN: r175975
2011-06-16re PR tree-optimization/49419 (gcc -O2 miscompiles gp2c)Jakub Jelinek1-2/+4
PR tree-optimization/49419 * tree-vrp.c (execute_vrp): Call init_range_assertions before estimate_numbers_of_iterations, call free_number_of_iterations_estimates before calling remove_range_assertions. * gcc.c-torture/execute/pr49419.c: New test. From-SVN: r175092
2011-06-14dumping cleanup phase 1 -- Removing TODO_dump_funcDavid Li1-1/+0
From-SVN: r175051
2011-06-14re PR middle-end/45098 (Missed induction variable optimization)Zdenek Dvorak1-32/+30
2011-06-14 Zdenek Dvorak <ook@ucw.cz> Tom de Vries <tom@codesourcery.com> PR target/45098 * cfgloop.h (nb_iterations_upper_bound, nb_iterations_estimate): Document changed semantics. (max_stmt_executions, max_stmt_executions_int): Declare. * tree-data-ref.c (estimated_loop_iterations) (estimated_loop_iterations_int): Move functions... * tree-ssa-loop-niter.c (estimated_loop_iterations) (estimated_loop_iterations_int): here. (record_estimate): Change nb_iterations_upper_bound and nb_iterations_estimate semantics. (max_stmt_executions, max_stmt_executions_int): New function. * tree-data-ref.c (estimated_loop_iterations_tree): Rename to ... (max_stmt_executions_tree): this. (analyze_miv_subscript): Use max_stmt_executions_tree instead of estimated_loop_iterations_tree. tree-ssa-loop-ivopts.c (avg_loop_niter): Use max_stmt_executions_int instead of estimated_loop_iterations_int. * predict.c (predict_loops): Idem. * tree-parloops.c (parallelize_loops): Idem. * tree-data-ref.c (analyze_siv_subscript_cst_affine) (compute_overlap_steps_for_affine_1_2, analyze_subscript_affine_affine) (init_omega_for_ddr_1): Idem. * tree-ssa-loop-prefetch.c (determine_loop_nest_reuse) (loop_prefetch_arrays): Idem * graphite-sese-to-poly.c (build_loop_iteration_domains): Use max_stmt_executions instead of estimated_loop_iterations. * tree-data-ref.c (estimated_loop_iterations_tree): Idem. * tree-vrp.c (adjust_range_with_scev): Use estimated_loop_iterations instead of nb_iterations_upper_bound. Co-Authored-By: Tom de Vries <tom@codesourcery.com> From-SVN: r175022
2011-05-30re PR tree-optimization/49218 (Incorrect optimization of a 'for' loop ↵Richard Guenther1-4/+10
creates an infinite loop) 2011-05-30 Richard Guenther <rguenther@suse.de> PR tree-optimization/49218 * tree-vrp.c (adjust_range_with_scev): Properly check whether overflow occured. * gcc.c-torture/execute/pr49218.c: New testcase. From-SVN: r174429
2011-05-26re PR tree-optimization/49161 (Fix VRP on switch stmts)Jakub Jelinek1-24/+34
PR tree-optimization/49161 * tree-vrp.c (struct case_info): New type. (compare_case_labels): Sort case_info structs instead of trees, and not primarily by CASE_LABEL uids but by label_for_block indexes. (find_switch_asserts): Put case labels into struct case_info array instead of TREE_VEC, adjust sorting, compare label_for_block values instead of CASE_LABELs. * gcc.c-torture/execute/pr49161.c: New test. From-SVN: r174270
2011-05-18re PR c++/49039 (LLVM StringRef miscompilation with -O2)Jakub Jelinek1-10/+20
PR tree-optimization/49039 * tree-vrp.c (extract_range_from_binary_expr): For MIN_EXPR <~[a, b], ~[c, d]> and MAX_EXPR <~[a, b], ~[c, d]> return ~[MAX_EXPR <a, c>, MIN_EXPR <b, d>]. * gcc.c-torture/execute/pr49039.c: New test. * gcc.dg/tree-ssa/pr49039.c: New test. * g++.dg/torture/pr49039.C: New test. From-SVN: r173876
2011-05-04tree.h (int_const_binop): Remove notrunc argument.Richard Guenther1-15/+15
2011-05-04 Richard Guenther <rguenther@suse.de> * tree.h (int_const_binop): Remove notrunc argument. * fold-const.c (int_const_binop): Remove notrunc argument. Always create integer constants that are properly truncated. (extract_muldiv_1): Expand one notrunc int_const_binop caller. (const_binop): Remove zero notrunc argument to int_const_binop. (size_binop_loc): Likewise. (fold_div_compare): Likewise. (maybe_canonicalize_comparison_1): Likewise. (fold_comparison): Likewise. (fold_binary_loc): Likewise. (multiple_of_p): Likewise. * expr.c (store_constructor): Likewise. * gimple-fold.c (maybe_fold_offset_to_array_ref): Likewise. (maybe_fold_stmt_addition): Likewise. * ipa-prop.c (ipa_modify_call_arguments): Likewise. * stor-layout.c (layout_type): Likewise. * tree-data-ref.c (tree_fold_divides_p): Likewise. * tree-sra.c (build_ref_for_offset): Likewise. (build_user_friendly_ref_for_offset): Likewise. * tree-ssa-address.c (maybe_fold_tmr): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Likewise. * tree-ssa-loop-niter.c (inverse): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Likewise. * tree-ssa.c (maybe_rewrite_mem_ref_base): Likewise. * tree-switch-conversion.c (check_range): Likewise. (build_constructors): Likewise. * tree-vect-generic.c (expand_vector_piecewise): Likewise. * tree-vrp.c (set_and_canonicalize_value_range): Likewise. (extract_range_from_assert): Likewise. (vrp_int_const_binop): Likewise. (extract_range_from_binary_expr): Likewise. (extract_range_from_unary_expr): Likewise. (check_array_ref): Likewise. (find_case_label_range): Likewise. (simplify_div_or_mod_using_ranges): Likewise. * tree-cfg.c (group_case_labels_stmt): Use double-ints for comparing case labels for merging. ada/ * gcc-interface/trans.c (gnat_to_gnu): Remove zero notrunc argument to int_const_binop. (pos_to_constructor): Likewise. fortran/ * trans-types.c (gfc_get_array_type_bounds): Remove zero notrunc argument to int_const_binop. From-SVN: r173356
2011-04-29builtins.c (fold_builtin_classify_type): Use integer_type_node for the type ↵Richard Guenther1-1/+1
of the result. 2011-04-29 Richard Guenther <rguenther@suse.de> * builtins.c (fold_builtin_classify_type): Use integer_type_node for the type of the result. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Use integer_type_node where appropriate. (fold_builtin_logb): Likewise. (fold_builtin_frexp): Likewise. (fold_builtin_strstr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_sprintf): Likewise. (fold_builtin_snprintf): Likewise. (fold_builtin_printf): Likewise. (do_mpfr_remquo): Use a proper type for the assigned constant. (do_mpfr_lgamma_r): Likewise. * dwarf2out.c (resolve_one_addr): Use size_int. * except.c (init_eh): Likewise. (assign_filter_values): Use integer_type_node for filter values. (sjlj_emit_dispatch_table): Use integer_type_node for dispatch indices. * tree-cfg.c (move_stmt_eh_region_tree_nr): Use integer_type_node for EH region numbers. * tree-vrp.c (simplify_div_or_mod_using_ranges): Use integer_type_node for the shift amount. From-SVN: r173167
2011-04-25tree-vrp.c (identify_jump_threads): Handle GIMPLE_SWITCH too.Jeff Law1-11/+11
* tree-vrp.c (identify_jump_threads): Handle GIMPLE_SWITCH too. * gcc.dg/tree-ssa/vrp56.c: new test. From-SVN: r172938
2011-03-24re PR tree-optimization/46562 (CCP currently needs iteration for &a[i])Richard Guenther1-2/+22
2011-03-24 Richard Guenther <rguenther@suse.de> PR tree-optimization/46562 * tree.c (build_invariant_address): New function. * tree.h (build_invariant_address): Declare. * tree-dfa.c (get_addr_base_and_unit_offset): Wrap around a renamed function moved ... * tree-flow-inline.h (get_addr_base_and_unit_offset_1): ... here. Take valueization callback parameter. * tree-flow.h (gimple_fold_stmt_to_constant): Declare. * gimple-fold.h: New file. * tree-ssa-ccp.c (ccp_fold): Use gimple_fold_stmt_to_constant_1. (ccp_fold, fold_const_aggregate_ref, fold_ctor_reference, fold_nonarray_ctor_reference, fold_array_ctor_reference, fold_string_cst_ctor_reference, get_base_constructor): Move ... * gimple-fold.c: ... here. (gimple_fold_stmt_to_constant_1): New function split out from ccp_fold. Take a valueization callback parameter. Valueize all operands. (gimple_fold_stmt_to_constant): New wrapper function. (fold_const_aggregate_ref_1): New function split out from fold_const_aggregate_ref. Take a valueization callback parameter. (fold_const_aggregate_ref): Wrap fold_const_aggregate_ref_1. * tree-ssa-sccvn.c (simplify_binary_expression): Simplify invariant POINTER_PLUS_EXPRs to invariant form. (vn_valueize): New function. (try_to_simplify): Simplify by using gimple_fold_stmt_to_constant. * tree-vrp.c (vrp_valueize): New function. (vrp_visit_assignment_or_call): Use gimple_fold_stmt_to_constant to fold statements to constants. * tree-ssa-pre.c (eliminate): Properly guard propagation of function declarations. * Makefile.in (tree-ssa-sccvn.o, tree-vrp.o, gimple-fold.o, tree-ssa-ccp.o): Add gimple-fold.h dependencies. * c-c++-common/pr46562-2.c: New testcase. * c-c++-common/pr46562.c: Likewise. From-SVN: r171386
2011-03-22re PR tree-optimization/48228 (incorrect signed overflow warning when only 0 ↵Richard Guenther1-0/+1
and 1 are used) 2011-03-22 Richard Guenther <rguenther@suse.de> PR tree-optimization/48228 * tree-vrp.c (vrp_visit_phi_node): Do not stop propagating for single-arg PHIs. * gcc.dg/Wstrict-overflow-23.c: New testcase. From-SVN: r171287
2011-03-16tree-vrp.c (identify_jump_threads): Slightly simplify type check for ↵Jeff Law1-4/+6
operands of conditional. * tree-vrp.c (identify_jump_threads): Slightly simplify type check for operands of conditional. Allow type to be a pointer. * gcc.dg/tree-ssa/vrp55.c: New test. From-SVN: r171055
2011-02-14re PR tree-optimization/46494 (ICE: verify_flow_info failed when casting-out ↵Eric Botcazou1-2/+3
attribute noreturn with -fno-tree-ccp -fno-tree-fre -ftree-vrp) PR tree-optimization/46494 * loop-unroll.c (split_edge_and_insert): Adjust comment. * loop-init.c (loop_optimizer_finalize): Do not call verify_flow_info. (pass_rtl_loop_done): Add TODO_verify_flow. * fwprop.c (pass_rtl_fwprop): Likewise. * modulo-sched.c (pass_sms): Likewise. * tree-ssa-dom.c (pass_dominator): Likewise. * tree-ssa-loop-ch.c (pass_ch): Likewise. * tree-ssa-loop.c (pass_complete_unrolli): Likewise. (pass_tree_loop_done): Likewise. * tree-ssa-pre.c (execute_pre): Likewise. * tree-ssa-reassoc.c (pass_reassoc): Likewise. * tree-ssa-sink.c (pass_sink_code): Likewise. * tree-vrp.c (pass_vrp): Likewise. From-SVN: r170141