summaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
AgeCommit message (Collapse)Author
2020-01-01Update copyright years.Jakub Jelinek
From-SVN: r279813
2019-12-05PR middle-end/92622 - FAIL: gcc.dg/Warray-bounds-22.c on ILP32: missing ↵Martin Sebor
warnings for VLA on lines 67 and 69 gcc/ChangeLog: PR middle-end/92622 * tree-vrp.c (vrp_prop::check_array_ref): Avoid using a variable left uninitialized by get_addr_base_and_unit_offset ofn failure. From-SVN: r279029
2019-11-14Change fold_range to return a boolean result.Andrew MacLeod
2019-11-14 Andrew MacLeod <amacleod@redhat.com> * range-op.h (range_operator::fold_range): Return a bool. * range-op.cc (range_operator::wi_fold): Assert supported type. (range_operator::fold_range): Assert supported type and return true. (operator_equal::fold_range): Return true. (operator_not_equal::fold_range): Same. (operator_lt::fold_range): Same. (operator_le::fold_range): Same. (operator_gt::fold_range): Same. (operator_ge::fold_range): Same. (operator_plus::op1_range): Adjust call to fold_range. (operator_plus::op2_range): Same. (operator_minus::op1_range): Same. (operator_minus::op2_range): Same. (operator_exact_divide::op1_range): Same. (operator_lshift::fold_range): Return true and adjust fold_range call. (operator_rshift::fold_range): Same. (operator_cast::fold_range): Return true. (operator_logical_and::fold_range): Same. (operator_logical_or::fold_range): Same. (operator_logical_not::fold_range): Same. (operator_bitwise_not::fold_range): Adjust call to fold_range. (operator_bitwise_not::op1_range): Same. (operator_cst::fold_range): Return true. (operator_identity::fold_range): Return true. (operator_negate::fold_range): Return true and adjust fold_range call. (operator_addr_expr::fold_range): Return true. (operator_addr_expr::op1_range): Adjust call to fold_range. (range_cast): Same. * tree-vrp.c (range_fold_binary_symbolics_p): Adjust call to fold_range. (range_fold_unary_symbolics_p): Same. From-SVN: r278266
2019-11-14Make normalize_addresses and normalize_symbolics work on THIS, insteadAldy Hernandez
of returning by value. From-SVN: r278196
2019-11-13Move plain value_range things to value-range.[hc]*.Aldy Hernandez
From-SVN: r278153
2019-11-13Rewrite value_range constructors to the value_range_kind is at the end, and ↵Aldy Hernandez
defaults to VR_RANGE. Rewrite value_range constructors to the value_range_kind is at the end, and defaults to VR_RANGE. Similarly for set() methods. From-SVN: r278148
2019-11-12Remove gcc/params.* files.Martin Liska
2019-11-12 Martin Liska <mliska@suse.cz> * Makefile.in: Remove PARAMS_H and params.list and params.options. * params-enum.h: Remove. * params-list.h: Remove. * params-options.h: Remove. * params.c: Remove. * params.def: Remove. * params.h: Remove. * asan.c: Do not include params.h. * auto-profile.c: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfgloopanal.c: Likewise. * cgraph.c: Likewise. * combine.c: Likewise. * common/config/aarch64/aarch64-common.c: Likewise. * common/config/gcn/gcn-common.c: Likewise. * common/config/ia64/ia64-common.c: Likewise. * common/config/powerpcspe/powerpcspe-common.c: Likewise. * common/config/rs6000/rs6000-common.c: Likewise. * common/config/sh/sh-common.c: Likewise. * config/aarch64/aarch64.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/avr/avr.c: Likewise. * config/csky/csky.c: Likewise. * config/i386/i386-builtins.c: Likewise. * config/i386/i386-expand.c: Likewise. * config/i386/i386-features.c: Likewise. * config/i386/i386-options.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000-logue.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sparc/sparc.c: Likewise. * config/visium/visium.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dse.c: Likewise. * emit-rtl.c: Likewise. * explow.c: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * gimple-loop-interchange.cc: Likewise. * gimple-loop-jam.c: Likewise. * gimple-loop-versioning.cc: Likewise. * gimple-ssa-split-paths.c: Likewise. * gimple-ssa-sprintf.c: Likewise. * gimple-ssa-store-merging.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-ssa-warn-alloca.c: Likewise. * gimple-ssa-warn-restrict.c: Likewise. * graphite-isl-ast-to-gimple.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * haifa-sched.c: Likewise. * hsa-gen.c: Likewise. * ifcvt.c: Likewise. * ipa-cp.c: Likewise. * ipa-fnsummary.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline.c: Likewise. * ipa-polymorphic-call.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-sra.c: Likewise. * ira-build.c: Likewise. * ira-conflicts.c: Likewise. * loop-doloop.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lra-assigns.c: Likewise. * lra-constraints.c: Likewise. * modulo-sched.c: Likewise. * opt-suggestions.c: Likewise. * opts.c: Likewise. * postreload-gcse.c: Likewise. * predict.c: Likewise. * reload.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * sanopt.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched.c: Likewise. * shrink-wrap.c: Likewise. * stmt.c: Likewise. * targhooks.c: Likewise. * toplev.c: Likewise. * tracer.c: Likewise. * trans-mem.c: Likewise. * tree-chrec.c: Likewise. * tree-data-ref.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-parloops.c: Likewise. * tree-predcom.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-scopedtables.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadbackward.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * value-prof.c: Likewise. * var-tracking.c: Likewise. 2019-11-12 Martin Liska <mliska@suse.cz> * gimple-parser.c: Do not include params.h. 2019-11-12 Martin Liska <mliska@suse.cz> * name-lookup.c: Do not include params.h. * typeck.c: Likewise. 2019-11-12 Martin Liska <mliska@suse.cz> * lto-common.c: Do not include params.h. * lto-partition.c: Likewise. * lto.c: Likewise. From-SVN: r278086
2019-11-12Apply mechanical replacement (generated patch).Martin Liska
2019-11-12 Martin Liska <mliska@suse.cz> * asan.c (asan_sanitize_stack_p): Replace old parameter syntax with the new one, include opts.h if needed. Use SET_OPTION_IF_UNSET macro. (asan_sanitize_allocas_p): Likewise. (asan_emit_stack_protection): Likewise. (asan_protect_global): Likewise. (instrument_derefs): Likewise. (instrument_builtin_call): Likewise. (asan_expand_mark_ifn): Likewise. * auto-profile.c (auto_profile): Likewise. * bb-reorder.c (copy_bb_p): Likewise. (duplicate_computed_gotos): Likewise. * builtins.c (inline_expand_builtin_string_cmp): Likewise. * cfgcleanup.c (try_crossjump_to_edge): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.c (defer_stack_allocation): Likewise. (stack_protect_classify_type): Likewise. (pass_expand::execute): Likewise. * cfgloopanal.c (expected_loop_iterations_unbounded): Likewise. (estimate_reg_pressure_cost): Likewise. * cgraph.c (cgraph_edge::maybe_hot_p): Likewise. * combine.c (combine_instructions): Likewise. (record_value_for_reg): Likewise. * common/config/aarch64/aarch64-common.c (aarch64_option_validate_param): Likewise. (aarch64_option_default_params): Likewise. * common/config/ia64/ia64-common.c (ia64_option_default_params): Likewise. * common/config/powerpcspe/powerpcspe-common.c (rs6000_option_default_params): Likewise. * common/config/rs6000/rs6000-common.c (rs6000_option_default_params): Likewise. * common/config/sh/sh-common.c (sh_option_default_params): Likewise. * config/aarch64/aarch64.c (aarch64_output_probe_stack_range): Likewise. (aarch64_allocate_and_probe_stack_space): Likewise. (aarch64_expand_epilogue): Likewise. (aarch64_override_options_internal): Likewise. * config/alpha/alpha.c (alpha_option_override): Likewise. * config/arm/arm.c (arm_option_override): Likewise. (arm_valid_target_attribute_p): Likewise. * config/i386/i386-options.c (ix86_option_override_internal): Likewise. * config/i386/i386.c (get_probe_interval): Likewise. (ix86_adjust_stack_and_probe_stack_clash): Likewise. (ix86_max_noce_ifcvt_seq_cost): Likewise. * config/ia64/ia64.c (ia64_adjust_cost): Likewise. * config/rs6000/rs6000-logue.c (get_stack_clash_protection_probe_interval): Likewise. (get_stack_clash_protection_guard_size): Likewise. * config/rs6000/rs6000.c (rs6000_option_override_internal): Likewise. * config/s390/s390.c (allocate_stack_space): Likewise. (s390_emit_prologue): Likewise. (s390_option_override_internal): Likewise. * config/sparc/sparc.c (sparc_option_override): Likewise. * config/visium/visium.c (visium_option_override): Likewise. * coverage.c (get_coverage_counts): Likewise. (coverage_compute_profile_id): Likewise. (coverage_begin_function): Likewise. (coverage_end_function): Likewise. * cse.c (cse_find_path): Likewise. (cse_extended_basic_block): Likewise. (cse_main): Likewise. * cselib.c (cselib_invalidate_mem): Likewise. * dse.c (dse_step1): Likewise. * emit-rtl.c (set_new_first_and_last_insn): Likewise. (get_max_insn_count): Likewise. (make_debug_insn_raw): Likewise. (init_emit): Likewise. * explow.c (compute_stack_clash_protection_loop_data): Likewise. * final.c (compute_alignments): Likewise. * fold-const.c (fold_range_test): Likewise. (fold_truth_andor): Likewise. (tree_single_nonnegative_warnv_p): Likewise. (integer_valued_real_single_p): Likewise. * gcse.c (want_to_gcse_p): Likewise. (prune_insertions_deletions): Likewise. (hoist_code): Likewise. (gcse_or_cprop_is_too_expensive): Likewise. * ggc-common.c: Likewise. * ggc-page.c (ggc_collect): Likewise. * gimple-loop-interchange.cc (MAX_NUM_STMT): Likewise. (MAX_DATAREFS): Likewise. (OUTER_STRIDE_RATIO): Likewise. * gimple-loop-jam.c (tree_loop_unroll_and_jam): Likewise. * gimple-loop-versioning.cc (loop_versioning::max_insns_for_loop): Likewise. * gimple-ssa-split-paths.c (is_feasible_trace): Likewise. * gimple-ssa-store-merging.c (imm_store_chain_info::try_coalesce_bswap): Likewise. (imm_store_chain_info::coalesce_immediate_stores): Likewise. (imm_store_chain_info::output_merged_store): Likewise. (pass_store_merging::process_store): Likewise. * gimple-ssa-strength-reduction.c (find_basis_for_base_expr): Likewise. * graphite-isl-ast-to-gimple.c (class translate_isl_ast_to_gimple): Likewise. (scop_to_isl_ast): Likewise. * graphite-optimize-isl.c (get_schedule_for_node_st): Likewise. (optimize_isl): Likewise. * graphite-scop-detection.c (build_scops): Likewise. * haifa-sched.c (set_modulo_params): Likewise. (rank_for_schedule): Likewise. (model_add_to_worklist): Likewise. (model_promote_insn): Likewise. (model_choose_insn): Likewise. (queue_to_ready): Likewise. (autopref_multipass_dfa_lookahead_guard): Likewise. (schedule_block): Likewise. (sched_init): Likewise. * hsa-gen.c (init_prologue): Likewise. * ifcvt.c (bb_ok_for_noce_convert_multiple_sets): Likewise. (cond_move_process_if_block): Likewise. * ipa-cp.c (ipcp_lattice::add_value): Likewise. (merge_agg_lats_step): Likewise. (devirtualization_time_bonus): Likewise. (hint_time_bonus): Likewise. (incorporate_penalties): Likewise. (good_cloning_opportunity_p): Likewise. (ipcp_propagate_stage): Likewise. * ipa-fnsummary.c (decompose_param_expr): Likewise. (set_switch_stmt_execution_predicate): Likewise. (analyze_function_body): Likewise. (compute_fn_summary): Likewise. * ipa-inline-analysis.c (estimate_growth): Likewise. * ipa-inline.c (caller_growth_limits): Likewise. (inline_insns_single): Likewise. (inline_insns_auto): Likewise. (can_inline_edge_by_limits_p): Likewise. (want_early_inline_function_p): Likewise. (big_speedup_p): Likewise. (want_inline_small_function_p): Likewise. (want_inline_self_recursive_call_p): Likewise. (edge_badness): Likewise. (recursive_inlining): Likewise. (compute_max_insns): Likewise. (early_inliner): Likewise. * ipa-polymorphic-call.c (csftc_abort_walking_p): Likewise. * ipa-profile.c (ipa_profile): Likewise. * ipa-prop.c (determine_known_aggregate_parts): Likewise. (ipa_analyze_node): Likewise. (ipcp_transform_function): Likewise. * ipa-split.c (consider_split): Likewise. * ipa-sra.c (allocate_access): Likewise. (process_scan_results): Likewise. (ipa_sra_summarize_function): Likewise. (pull_accesses_from_callee): Likewise. * ira-build.c (loop_compare_func): Likewise. (mark_loops_for_removal): Likewise. * ira-conflicts.c (build_conflict_bit_table): Likewise. * loop-doloop.c (doloop_optimize): Likewise. * loop-invariant.c (gain_for_invariant): Likewise. (move_loop_invariants): Likewise. * loop-unroll.c (decide_unroll_constant_iterations): Likewise. (decide_unroll_runtime_iterations): Likewise. (decide_unroll_stupid): Likewise. (expand_var_during_unrolling): Likewise. * lra-assigns.c (spill_for): Likewise. * lra-constraints.c (EBB_PROBABILITY_CUTOFF): Likewise. * modulo-sched.c (sms_schedule): Likewise. (DFA_HISTORY): Likewise. * opts.c (default_options_optimization): Likewise. (finish_options): Likewise. (common_handle_option): Likewise. * postreload-gcse.c (eliminate_partially_redundant_load): Likewise. (if): Likewise. * predict.c (get_hot_bb_threshold): Likewise. (maybe_hot_count_p): Likewise. (probably_never_executed): Likewise. (predictable_edge_p): Likewise. (predict_loops): Likewise. (expr_expected_value_1): Likewise. (tree_predict_by_opcode): Likewise. (handle_missing_profiles): Likewise. * reload.c (find_equiv_reg): Likewise. * reorg.c (redundant_insn): Likewise. * resource.c (mark_target_live_regs): Likewise. (incr_ticks_for_insn): Likewise. * sanopt.c (pass_sanopt::execute): Likewise. * sched-deps.c (sched_analyze_1): Likewise. (sched_analyze_2): Likewise. (sched_analyze_insn): Likewise. (deps_analyze_insn): Likewise. * sched-ebb.c (schedule_ebbs): Likewise. * sched-rgn.c (find_single_block_region): Likewise. (too_large): Likewise. (haifa_find_rgns): Likewise. (extend_rgns): Likewise. (new_ready): Likewise. (schedule_region): Likewise. (sched_rgn_init): Likewise. * sel-sched-ir.c (make_region_from_loop): Likewise. * sel-sched-ir.h (MAX_WS): Likewise. * sel-sched.c (process_pipelined_exprs): Likewise. (sel_setup_region_sched_flags): Likewise. * shrink-wrap.c (try_shrink_wrapping): Likewise. * targhooks.c (default_max_noce_ifcvt_seq_cost): Likewise. * toplev.c (print_version): Likewise. (process_options): Likewise. * tracer.c (tail_duplicate): Likewise. * trans-mem.c (tm_log_add): Likewise. * tree-chrec.c (chrec_fold_plus_1): Likewise. * tree-data-ref.c (split_constant_offset): Likewise. (compute_all_dependences): Likewise. * tree-if-conv.c (MAX_PHI_ARG_NUM): Likewise. * tree-inline.c (remap_gimple_stmt): Likewise. * tree-loop-distribution.c (MAX_DATAREFS_NUM): Likewise. * tree-parloops.c (MIN_PER_THREAD): Likewise. (create_parallel_loop): Likewise. * tree-predcom.c (determine_unroll_factor): Likewise. * tree-scalar-evolution.c (instantiate_scev_r): Likewise. * tree-sra.c (analyze_all_variable_accesses): Likewise. * tree-ssa-ccp.c (fold_builtin_alloca_with_align): Likewise. * tree-ssa-dse.c (setup_live_bytes_from_ref): Likewise. (dse_optimize_redundant_stores): Likewise. (dse_classify_store): Likewise. * tree-ssa-ifcombine.c (ifcombine_ifandif): Likewise. * tree-ssa-loop-ch.c (ch_base::copy_headers): Likewise. * tree-ssa-loop-im.c (LIM_EXPENSIVE): Likewise. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise. (try_peel_loop): Likewise. (tree_unroll_loops_completely): Likewise. * tree-ssa-loop-ivopts.c (avg_loop_niter): Likewise. (CONSIDER_ALL_CANDIDATES_BOUND): Likewise. (MAX_CONSIDERED_GROUPS): Likewise. (ALWAYS_PRUNE_CAND_SET_BOUND): Likewise. * tree-ssa-loop-manip.c (can_unroll_loop_p): Likewise. * tree-ssa-loop-niter.c (MAX_ITERATIONS_TO_TRACK): Likewise. * tree-ssa-loop-prefetch.c (PREFETCH_BLOCK): Likewise. (L1_CACHE_SIZE_BYTES): Likewise. (L2_CACHE_SIZE_BYTES): Likewise. (should_issue_prefetch_p): Likewise. (schedule_prefetches): Likewise. (determine_unroll_factor): Likewise. (volume_of_references): Likewise. (add_subscript_strides): Likewise. (self_reuse_distance): Likewise. (mem_ref_count_reasonable_p): Likewise. (insn_to_prefetch_ratio_too_small_p): Likewise. (loop_prefetch_arrays): Likewise. (tree_ssa_prefetch_arrays): Likewise. * tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Likewise. * tree-ssa-math-opts.c (gimple_expand_builtin_pow): Likewise. (convert_mult_to_fma): Likewise. (math_opts_dom_walker::after_dom_children): Likewise. * tree-ssa-phiopt.c (cond_if_else_store_replacement): Likewise. (hoist_adjacent_loads): Likewise. (gate_hoist_loads): Likewise. * tree-ssa-pre.c (translate_vuse_through_block): Likewise. (compute_partial_antic_aux): Likewise. * tree-ssa-reassoc.c (get_reassociation_width): Likewise. * tree-ssa-sccvn.c (vn_reference_lookup_pieces): Likewise. (vn_reference_lookup): Likewise. (do_rpo_vn): Likewise. * tree-ssa-scopedtables.c (avail_exprs_stack::lookup_avail_expr): Likewise. * tree-ssa-sink.c (select_best_block): Likewise. * tree-ssa-strlen.c (new_stridx): Likewise. (new_addr_stridx): Likewise. (get_range_strlen_dynamic): Likewise. (class ssa_name_limit_t): Likewise. * tree-ssa-structalias.c (push_fields_onto_fieldstack): Likewise. (create_variable_info_for_1): Likewise. (init_alias_vars): Likewise. * tree-ssa-tail-merge.c (find_clusters_1): Likewise. (tail_merge_optimize): Likewise. * tree-ssa-threadbackward.c (thread_jumps::profitable_jump_thread_path): Likewise. (thread_jumps::fsm_find_control_statement_thread_paths): Likewise. (thread_jumps::find_jump_threads_backwards): Likewise. * tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts_at_dest): Likewise. * tree-ssa-uninit.c (compute_control_dep_chain): Likewise. * tree-switch-conversion.c (switch_conversion::check_range): Likewise. (jump_table_cluster::can_be_handled): Likewise. * tree-switch-conversion.h (jump_table_cluster::case_values_threshold): Likewise. (SWITCH_CONVERSION_BRANCH_RATIO): Likewise. (param_switch_conversion_branch_ratio): Likewise. * tree-vect-data-refs.c (vect_mark_for_runtime_alias_test): Likewise. (vect_enhance_data_refs_alignment): Likewise. (vect_prune_runtime_alias_test_list): Likewise. * tree-vect-loop.c (vect_analyze_loop_costing): Likewise. (vect_get_datarefs_in_loop): Likewise. (vect_analyze_loop): Likewise. * tree-vect-slp.c (vect_slp_bb): Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c (find_switch_asserts): Likewise. (vrp_prop::check_mem_ref): Likewise. * tree.c (wide_int_to_tree_1): Likewise. (cache_integer_cst): Likewise. * var-tracking.c (EXPR_USE_DEPTH): Likewise. (reverse_op): Likewise. (vt_find_locations): Likewise. 2019-11-12 Martin Liska <mliska@suse.cz> * gimple-parser.c (c_parser_parse_gimple_body): Replace old parameter syntax with the new one, include opts.h if needed. Use SET_OPTION_IF_UNSET macro. 2019-11-12 Martin Liska <mliska@suse.cz> * name-lookup.c (namespace_hints::namespace_hints): Replace old parameter syntax with the new one, include opts.h if needed. Use SET_OPTION_IF_UNSET macro. * typeck.c (comptypes): Likewise. 2019-11-12 Martin Liska <mliska@suse.cz> * lto-partition.c (lto_balanced_map): Replace old parameter syntax with the new one, include opts.h if needed. Use SET_OPTION_IF_UNSET macro. * lto.c (do_whole_program_analysis): Likewise. From-SVN: r278085
2019-11-12re PR tree-optimization/92452 (ICE in vrp_prop::check_array_ref at ↵Jakub Jelinek
tree-vrp.c:4153) PR tree-optimization/92452 * tree-vrp.c (vrp_prop::check_array_ref): If TRUNC_DIV_EXPR folds into NULL_TREE, set up_bound to NULL_TREE instead of computing MINUS_EXPR on it. * c-c++-common/pr92452.c: New test. From-SVN: r278080
2019-11-08Modify range_operator::fold_range() and wi_fold () to return via reference.Andrew MacLeod
2019-11-08 Andrew MacLeod <amacleod@redhat.com> * range-op.h (range_operator::fold_range): Return result in a reference parameter instead of by value. (range_operator::wi_fold): Same. * range-op.cc (range_operator::wi_fold): Return result in a reference parameter instead of by value. (range_operator::fold_range): Same. (value_range_from_overflowed_bounds): Same. (value_range_with_overflow): Same (create_possibly_reversed_range): Same. (operator_equal::fold_range): Same. (operator_not_equal::fold_range): Same. (operator_lt::fold_range): Same. (operator_le::fold_range): Same. (operator_gt::fold_range): Same. (operator_ge::fold_range): Same. (operator_plus::wi_fold): Same. (operator_plus::op1_range): Change call to fold_range. (operator_plus::op2_range): Change call to fold_range. (operator_minus::wi_fold): Return result via reference parameter. (operator_minus::op1_range): Change call to fold_range. (operator_minus::op2_range): Change call to fold_range. (operator_min::wi_fold): Return result via reference parameter. (operator_max::wi_fold): Same. (cross_product_operator::wi_cross_product): Same. (operator_mult::wi_fold): Same. (operator_div::wi_fold): Same. (operator_div op_floor_div): Fix whitespace. (operator_exact_divide::op1_range): Change call to fold_range. (operator_lshift::fold_range): Return result via reference parameter. (operator_lshift::wi_fold): Same. (operator_rshift::fold_range): Same. (operator_rshift::wi_fold): Same. (operator_cast::fold_range): Same. (operator_cast::op1_range): Change calls to fold_range. (operator_logical_and::fold_range): Return result via reference. (wi_optimize_and_or): Adjust call to value_range_with_overflow. (operator_bitwise_and::wi_fold): Return result via reference. (operator_logical_or::fold_range): Same. (operator_bitwise_or::wi_fold): Same. (operator_bitwise_xor::wi_fold): Same. (operator_trunc_mod::wi_fold): Same. (operator_logical_not::fold_range): Same. (operator_bitwise_not::fold_range): Same. (operator_bitwise_not::op1_range): Change call to fold_range. (operator_cst::fold_range): Return result via reference. (operator_identity::fold_range): Same. (operator_abs::wi_fold): Same. (operator_absu::wi_fold): Same. (operator_negate::fold_range): Same. (operator_negate::op1_range): Change call to fold_range. (operator_addr_expr::fold_range): Return result via reference. (operator_addr_expr::op1_range): Change call to fold_range. (operator_pointer_plus::wi_fold): Return result via reference. (operator_pointer_min_max::wi_fold): Same. (operator_pointer_and::wi_fold): Same. (operator_pointer_or::wi_fold): Same. (range_op_handler): Change call to fold_range. (range_cast): Same. * tree-vrp.c (range_fold_binary_symbolics_p): Change call to fold_range. (range_fold_unary_symbolics_p): Same. (range_fold_binary_expr): Same. (range_fold_unary_expr): Same. From-SVN: r277979
2019-11-05PR middle-end/92333 - missing variable name referencing VLA in warningsMartin Sebor
PR middle-end/92333 - missing variable name referencing VLA in warnings PR middle-end/82608 - missing -Warray-bounds on an out-of-bounds VLA index gcc/testsuite/ChangeLog: PR middle-end/92333 PR middle-end/82608 * gcc.dg/Warray-bounds-51.c: New test. gcc/ChangeLog: PR middle-end/92333 PR middle-end/82608 * tree-vrp.c (vrp_prop::check_array_ref): Handle VLAs with constant size. * tree-ssa-ccp.c (fold_builtin_alloca_with_align): Use a meaninful name and location for a temporary variable. From-SVN: r277854
2019-11-05Fix indentation inconsistencies introduced by previous patch.Aldy Hernandez
From-SVN: r277852
2019-11-05PR middle-end/92341 - missing -Warray-bounds indexing past the end of a ↵Martin Sebor
compound literal PR middle-end/92341 - missing -Warray-bounds indexing past the end of a compound literal PR middle-end/82612 - missing -Warray-bounds on a non-zero offset from the address of a non-array object gcc/testsuite/ChangeLog: PR middle-end/92341 PR middle-end/82612 * g++.dg/warn/Warray-bounds-4.C: Adjust text of expected warning. * gcc.dg/Warray-bounds-53.c: New test. * gcc.dg/Warray-bounds-54.c: New test. gcc/ChangeLog: PR middle-end/92341 PR middle-end/82612 * tree-sra.c (get_access_for_expr): Fail for out-of-bounds offsets. * tree-vrp.c (vrp_prop::check_array_ref): Correct index and text of message printed in a warning for empty arrays. (vrp_prop::check_mem_ref): Also handle function parameters and empty arrays. From-SVN: r277851
2019-11-05The base class for ranges is currently value_range_base, which is rather ↵Aldy Hernandez
long and cumbersome. The base class for ranges is currently value_range_base, which is rather long and cumbersome. It also occurs more often than the derived class of value_range. To avoid confusion, and save typing, this patch does a global rename from value_range to value_range_equiv, and from value_range_base to value_range. This way, the base class is simply value_range, and the derived class is value_range_equiv which explicitly states what it does. From-SVN: r277847
2019-11-05Move vrp_set_zero_nonzero_bits from tree-vrp.c into vr-values.c, and make it ↵Aldy Hernandez
use wi_set_zero_nonzero_bits. Move vrp_set_zero_nonzero_bits from tree-vrp.c into vr-values.c, and make it use wi_set_zero_nonzero_bits. Remove the now redundant wide_int_range_set_zero_nonzero_bits. From-SVN: r277818
2019-11-05Move vrp_bitmap_equal_p above its only use and make it static.Aldy Hernandez
From-SVN: r277813
2019-11-05Use value_range_base::equal_p in value_range_base::operator== so we can handleAldy Hernandez
symbolics without dying. From-SVN: r277812
2019-11-04Do not special case pointers in value_range_base::set.Aldy Hernandez
From-SVN: r277799
2019-11-04Remove handle_pointers argument from all the vrp_val*{min,max} functions.Aldy Hernandez
Remove handle_pointers argument from all the vrp_val*{min,max} functions. Always assume pointers should be handled. From-SVN: r277796
2019-11-04Use the value_range_base constructors in value_range_base::invert toAldy Hernandez
make sure we build canonically correct ranges. From-SVN: r277794
2019-11-04Remove unused range_int_cst_singleton_p.Aldy Hernandez
From-SVN: r277792
2019-11-04Handle VR_UNDEFINED in value_range_base::normalize_addresses().Aldy Hernandez
From-SVN: r277791
2019-11-04Implement debugging functions for assert_info's.Aldy Hernandez
From-SVN: r277790
2019-11-04PR tree-optimization/92349 - ICE in -Warray-bounds of a VLA memberMartin Sebor
gcc/testsuite/ChangeLog: PR tree-optimization/92349 * gcc.dg/Warray-bounds-50.c: New test. gcc/ChangeLog: PR tree-optimization/92349 * tree-vrp.c (vrp_prop::check_array_ref): Avoid assuming struct memebers have constant sizes. From-SVN: r277786
2019-11-01PR middle-end/91679 - missing -Warray-bounds accessing a member array in a ↵Martin Sebor
local buffer PR middle-end/91679 - missing -Warray-bounds accessing a member array in a local buffer PR middle-end/91647 - new FAILs for Warray-bounds-8 and Wstringop-overflow-3.C PR middle-end/91463 - missing -Warray-bounds accessing past the end of a statically initialized flexible array member PR middle-end/92312 - bogus -Wstringop-overflow storing into a trailing array backed by larger buffer gcc/ChangeLog: PR middle-end/91679 PR middle-end/91647 PR middle-end/91463 PR middle-end/92312 * c-family/c-pretty-print.c (direct_abstract_declarator): Print bound in zero-length arrays. * gcc/c-family/c.opt (-Wzero-length-bounds): New option. * gcc/doc/invoke.texi (-Wzero-length-bounds): Document. * gimple-match-head.c (try_conditional_simplification): Use memcpy instead of a hand-rolled loop to avoid PR 92323. * tree-vrp.c (vrp_prop::check_array_ref): Handle trailing arrays with initializers. (vrp_prop::check_mem_ref): Handle declared struct objects. * tree.c (last_field): New function. (array_at_struct_end_p): Handle MEM_REF. (get_initializer_for): New helper. (component_ref_size): Add argument. Rename locals. Call get_initializer_for instead of fold_ctor_reference. Correct handling of flexible array members. * wide-int.h (generic_wide_int <storage>::sign_mask): Assert invariant. gcc/testsuite/ChangeLog: PR middle-end/91679 PR middle-end/91647 PR middle-end/91463 PR middle-end/92312 * c-c++-common/Warray-bounds-2.c: Disable VRP. Adjust expected messages. * g++.dg/warn/Warray-bounds-8.C: Remove xfails. * gcc.dg/Warray-bounds-48.c: New test. * gcc.dg/Warray-bounds-49.c: New test. * gcc.dg/Wstringop-overflow-16.c: Adjust text of expected messages. * gcc.dg/Wstringop-overflow-21.c: New test. * gcc.dg/Wzero-length-array-bounds.c: New test. * gcc.dg/pr36902.c: Remove xfail. * gcc.dg/strlenopt-57.c: Add an expected warning. From-SVN: r277728
2019-10-23re PR tree-optimization/92131 (incorrect assumption that (ao >= 0) is always ↵Eric Botcazou
false) PR tree-optimization/92131 * tree-vrp.c (extract_range_from_plus_minus_expr): If the resulting range would be symbolic, drop to varying for any explicit overflow in the constant part or if neither range is a singleton. From-SVN: r277314
2019-10-17re PR tree-optimization/92131 (incorrect assumption that (ao >= 0) is always ↵Aldy Hernandez
false) PR tree-optimization/92131 * tree-vrp.c (value_range_base::dump): Display +INF for both pointers and integers when appropriate. From-SVN: r277107
2019-10-16Deal with incoming POLY_INT_CST ranges (PR92033)Richard Sandiford
This patch makes value_range_base::set convert POLY_INT_CST bounds into the worst-case INTEGER_CST bounds. The main case in which this gives useful ranges is a lower bound of A + B * X becoming A when B >= 0. E.g.: [32 + 16X, 100] -> [32, 100] [32 + 16X, 32 + 16X] -> [32, MAX] But the same thing can be useful for the upper bound with negative X coefficients. 2019-10-16 Richard Sandiford <richard.sandiford@arm.com> gcc/ PR middle-end/92033 * poly-int.h (constant_lower_bound_with_limit): New function. (constant_upper_bound_with_limit): Likewise. * doc/poly-int.texi: Document them. * tree-vrp.c (value_range_base::set): Convert POLY_INT_CST bounds into the worst-case INTEGER_CST bounds. From-SVN: r277056
2019-10-14Normalize unsigned ~[0,0] into [1,MAX].Aldy Hernandez
From-SVN: r276949
2019-10-07Disentangle range_fold_*ary_expr() into various independent pieces.Aldy Hernandez
From-SVN: r276654
2019-10-07Use value_range_base::num_pairs instead of vrp_val_is* to check if a rangeAldy Hernandez
has one sub-range. From-SVN: r276653
2019-10-03Makefile.in (OBJS): Add range.o and range-op.o.Aldy Hernandez
* Makefile.in (OBJS): Add range.o and range-op.o. Remove wide-int-range.o. * function-tests.c (test_ranges): New. (function_tests_c_tests): Call test_ranges. * ipa-cp.c (ipa_vr_operation_and_type_effects): Call range_fold_unary_expr instead of extract_range_from_unary_expr. * ipa-prop.c (ipa_compute_jump_functions_for_edge): Same. * range-op.cc: New file. * range-op.h: New file. * range.cc: New file. * range.h: New file. * selftest.h (range_tests): New prototype. * ssa.h: Include range.h. * tree-vrp.c (value_range_base::value_range_base): New constructors. (value_range_base::singleton_p): Do not call ranges_from_anti_range until sure we will need to. (value_range_base::type): Rename gcc_assert to gcc_checking_assert. (vrp_val_is_max): New argument. (vrp_val_is_min): Same. (wide_int_range_set_zero_nonzero_bits): Move from wide-int-range.cc. (extract_range_into_wide_ints): Remove. (extract_range_from_multiplicative_op): Remove. (extract_range_from_pointer_plus_expr): Abstract POINTER_PLUS code from extract_range_from_binary_expr. (extract_range_from_plus_minus_expr): Abstract PLUS/MINUS code from extract_range_from_binary_expr. (extract_range_from_binary_expr): Remove. (normalize_for_range_ops): New. (range_fold_binary_expr): New. (range_fold_unary_expr): New. (value_range_base::num_pairs): New. (value_range_base::lower_bound): New. (value_range_base::upper_bound): New. (value_range_base::upper_bound): New. (value_range_base::contains_p): New. (value_range_base::invert): New. (value_range_base::union_): New. (value_range_base::intersect): New. (range_compatible_p): New. (value_range_base::operator==): New. (determine_value_range_1): Call range_fold_*expr instead of extract_range_from_*expr. * tree-vrp.h (class value_range_base): Add new constructors. Add methods for union_, intersect, operator==, contains_p, num_pairs, lower_bound, upper_bound, invert. (vrp_val_is_min): Add handle_pointers argument. (vrp_val_is_max): Same. (extract_range_from_unary_expr): Remove. (extract_range_from_binary_expr): Remove. (range_fold_unary_expr): New. (range_fold_binary_expr): New. * vr-values.c (vr_values::extract_range_from_binary_expr): Call range_fold_binary_expr instead of extract_range_from_binary_expr. (vr_values::extract_range_basic): Same. (vr_values::extract_range_from_unary_expr): Call range_fold_unary_expr instead of extract_range_from_unary_expr. * wide-int-range.cc: Remove. * wide-int-range.h: Remove. From-SVN: r276504
2019-09-03re PR tree-optimization/91597 (GCC miscompiles a branch depending on a ↵Jakub Jelinek
pointer tag) PR tree-optimization/91597 * tree-vrp.c (extract_range_from_binary_expr): Remove unsafe BIT_AND_EXPR optimization for pointers, even if both operand ranges don't include NULL, the result can be NULL. * gcc.c-torture/execute/pr91597.c: New test. Co-Authored-By: Richard Biener <rguenther@suse.de> From-SVN: r275330
2019-08-30PR middle-end/91584 - Bogus warning from -Warray-bounds during string assignmentMartin Sebor
gcc/ChangeLog: PR middle-end/91584 * tree-vrp.c (vrp_prop::check_mem_ref): Normalize type domain bounds before using them to validate MEM_REF offset. gcc/testsuite/ChangeLog: * gfortran.dg/char_array_constructor_4.f90: New test. From-SVN: r275210
2019-08-28PR tree-optimization/91457 - inconsistent warning for writing past the end ↵Martin Sebor
of an array member gcc/ChangeLog: PR tree-optimization/91457 * builtins.c (component_size): New function. (compute_objsize): Add argument. Handle ARRAY_REF and COMPONENT_REF. * builtins.h (compute_objsize): Add argument. * tree-ssa-strlen.c (handle_store): Handle no-warning bit. * tree-vrp.c (vrp_prop::check_array_ref): Return warning result. (vrp_prop::check_mem_ref): Same. (vrp_prop::search_for_addr_array): Set no-warning bit. (check_array_bounds): Same. gcc/testsuite/ChangeLog: PR tree-optimization/91457 * c-c++-common/Wstringop-overflow-2.c: New test. * g++.dg/warn/Warray-bounds-8.C: New test. * g++.dg/warn/Wstringop-overflow-3.C: New test. * gcc.dg/Wstringop-overflow-15.c: New test. From-SVN: r274997
2019-08-26PR tree-optimization/83431 - -Wformat-truncation may incorrectly report ↵Martin Sebor
truncation gcc/ChangeLog: PR c++/83431 * gimple-ssa-sprintf.c (pass_data_sprintf_length): Remove object. (sprintf_dom_walker): Remove class. (get_int_range): Make argument const. (directive::fmtfunc, directive::set_precision): Same. (format_none): Same. (build_intmax_type_nodes): Same. (adjust_range_for_overflow): Same. (format_floating): Same. (format_character): Same. (format_string): Same. (format_plain): Same. (get_int_range): Cast away constness. (format_integer): Same. (get_string_length): Call get_range_strlen_dynamic. Handle null lendata.maxbound. (should_warn_p): Adjust argument scope qualifier. (maybe_warn): Same. (format_directive): Same. (parse_directive): Same. (is_call_safe): Same. (try_substitute_return_value): Same. (sprintf_dom_walker::handle_printf_call): Rename... (handle_printf_call): ...to this. Initialize target to host charmap here instead of in pass_sprintf_length::execute. (struct call_info): Make global. (sprintf_dom_walker::compute_format_length): Make global. (sprintf_dom_walker::handle_gimple_call): Same. * passes.def (pass_sprintf_length): Replace with pass_strlen. * print-rtl.c (print_pattern): Reduce the number of spaces to avoid -Wformat-truncation. * tree-pass.h (make_pass_warn_printf): New function. * tree-ssa-strlen.c (strlen_optimize): New variable. (get_string_length): Add comments. (get_range_strlen_dynamic): New function. (check_and_optimize_call): New function. (handle_integral_assign): New function. (strlen_check_and_optimize_stmt): Factor code out into strlen_check_and_optimize_call and handle_integral_assign. (strlen_dom_walker::evrp): New member. (strlen_dom_walker::before_dom_children): Use evrp member. (strlen_dom_walker::after_dom_children): Use evrp member. (printf_strlen_execute): New function. (pass_strlen::gate): Update to handle printf calls. (dump_strlen_info): New function. (pass_data_warn_printf): New variable. (pass_warn_printf): New class. * tree-ssa-strlen.h (get_range_strlen_dynamic): Declare. (handle_printf_call): Same. * tree-vrp.c (value_range_base::type): Adjust assertion. * vr-values.c (vr_values::update_value_range): Use type of the first argument rather than the second. gcc/testsuite/ChangeLog: PR c++/83431 * gcc.dg/strlenopt-63.c: New test. * gcc.dg/pr79538.c: Adjust text of expected warning. * gcc.dg/pr81292-1.c: Adjust pass name. * gcc.dg/pr81292-2.c: Same. * gcc.dg/pr81703.c: Same. * gcc.dg/strcmpopt_2.c: Same. * gcc.dg/strcmpopt_3.c: Same. * gcc.dg/strcmpopt_4.c: Same. * gcc.dg/strlenopt-1.c: Same. * gcc.dg/strlenopt-10.c: Same. * gcc.dg/strlenopt-11.c: Same. * gcc.dg/strlenopt-13.c: Same. * gcc.dg/strlenopt-14g.c: Same. * gcc.dg/strlenopt-14gf.c: Same. * gcc.dg/strlenopt-15.c: Same. * gcc.dg/strlenopt-16g.c: Same. * gcc.dg/strlenopt-17g.c: Same. * gcc.dg/strlenopt-18g.c: Same. * gcc.dg/strlenopt-19.c: Same. * gcc.dg/strlenopt-1f.c: Same. * gcc.dg/strlenopt-2.c: Same. * gcc.dg/strlenopt-20.c: Same. * gcc.dg/strlenopt-21.c: Same. * gcc.dg/strlenopt-22.c: Same. * gcc.dg/strlenopt-22g.c: Same. * gcc.dg/strlenopt-24.c: Same. * gcc.dg/strlenopt-25.c: Same. * gcc.dg/strlenopt-26.c: Same. * gcc.dg/strlenopt-27.c: Same. * gcc.dg/strlenopt-28.c: Same. * gcc.dg/strlenopt-29.c: Same. * gcc.dg/strlenopt-2f.c: Same. * gcc.dg/strlenopt-3.c: Same. * gcc.dg/strlenopt-30.c: Same. * gcc.dg/strlenopt-31g.c: Same. * gcc.dg/strlenopt-32.c: Same. * gcc.dg/strlenopt-33.c: Same. * gcc.dg/strlenopt-33g.c: Same. * gcc.dg/strlenopt-34.c: Same. * gcc.dg/strlenopt-35.c: Same. * gcc.dg/strlenopt-4.c: Same. * gcc.dg/strlenopt-48.c: Same. * gcc.dg/strlenopt-49.c: Same. * gcc.dg/strlenopt-4g.c: Same. * gcc.dg/strlenopt-4gf.c: Same. * gcc.dg/strlenopt-5.c: Same. * gcc.dg/strlenopt-50.c: Same. * gcc.dg/strlenopt-51.c: Same. * gcc.dg/strlenopt-52.c: Same. * gcc.dg/strlenopt-53.c: Same. * gcc.dg/strlenopt-54.c: Same. * gcc.dg/strlenopt-55.c: Same. * gcc.dg/strlenopt-56.c: Same. * gcc.dg/strlenopt-6.c: Same. * gcc.dg/strlenopt-61.c: Same. * gcc.dg/strlenopt-7.c: Same. * gcc.dg/strlenopt-8.c: Same. * gcc.dg/strlenopt-9.c: Same. * gcc.dg/strlenopt.h (snprintf, snprintf): Declare. * gcc.dg/tree-ssa/builtin-snprintf-6.c: New test. * gcc.dg/tree-ssa/builtin-snprintf-7.c: New test. * gcc.dg/tree-ssa/builtin-snprintf-8.c: New test. * gcc.dg/tree-ssa/builtin-snprintf-9.c: New test. * gcc.dg/tree-ssa/builtin-sprintf-warn-21.c: New test. * gcc.dg/tree-ssa/dump-4.c: New test. * gcc.dg/tree-ssa/pr83501.c: Adjust pass name. From-SVN: r274933
2019-08-26[PATCH 1/2] Allow folding all statements.Robin Dapp
This patch allows users of the substitute_and_fold_engine to enable folding all statements. It is now enabled for VRP which is needed for the match.pd pattern in patch 2/2. The loop versioning pass was missing one case when deconstructing addresses that would only be triggered after this patch for me: It could handle addition and subsequent convert/nop but not a convert/nop directly. This would cause the hash to be calculated differently and, in turn, cause the pass to miss a versioning opportunity. Fixed this by adding the missing case. -- gcc/ChangeLog: 2019-08-26 Robin Dapp <rdapp@linux.ibm.com> * gimple-loop-versioning.cc (loop_versioning::record_address_fragment): Add nop_convert case. * tree-ssa-propagate.c (substitute_and_fold_dom_walker::before_dom_children): Fold all statements if requested. * tree-ssa-propagate.h (class substitute_and_fold_engine): Allow to fold all statements. * tree-vrp.c (class vrp_folder): Let substitute_and_fold_engine fold all statements. From-SVN: r274923
2019-08-16Add type to VR_VARYING.Aldy Hernandez
From-SVN: r274561
2019-08-15Enforce canonicalization in value_range.Aldy Hernandez
From-SVN: r274525
2019-07-31re PR tree-optimization/91257 (Compile-time and memory-hog hog)Richard Biener
2019-07-31 Richard Biener <rguenther@suse.de> PR tree-optimization/91257 * tree-vrp.c (union_ranges): Unify equality and less tests by using compare_values. Re-order cheap tests first. From-SVN: r273923
2019-07-29re PR tree-optimization/91257 (Compile-time and memory-hog hog)Richard Biener
2019-07-29 Richard Biener <rguenther@suse.de> PR tree-optimization/91257 * tree-vrp.c (operand_less_p): Avoid dispatching to fold for most cases, instead call compare_values which handles the symbolic ranges we handle specially. (compare_values_warnv): Do not call operand_less_p but open-code the effective fold calls. Avoid converting so much. From-SVN: r273876
2019-07-25tree-vrp.c (extract_range_from_multiplicative_op): Add type parameter and ↵Richard Biener
use it instead of guessing expression type from the... 2019-07-25 Richard Biener <rguenther@suse.de> * tree-vrp.c (extract_range_from_multiplicative_op): Add type parameter and use it instead of guessing expression type from the first operand. (extract_range_from_binary_expr): Pass expr_type down. From-SVN: r273797
2019-07-25gimple-loop-versioning.cc (loop_versioning::prune_loop_conditions): Make ↵Richard Biener
value_range * temporary const. 2019-07-25 Richard Biener <rguenther@suse.de> * gimple-loop-versioning.cc (loop_versioning::prune_loop_conditions): Make value_range * temporary const. * gimple-ssa-evrp-analyze.c (evrp_range_analyzer::try_find_new_range): Likewise. (evrp_range_analyzer::record_ranges_from_): Likewise. (evrp_range_analyzer::pop_value_range): Return a const value_range *, deal with having recorded a const one. * gimple-ssa-evrp-analyze.h (evrp_range_analyzer::get_value_range): Return a const value_range *. (evrp_range_analyzer::pop_value_range): Likewise. (evrp_range_analyzer::stack): Record const value_range *s. * gimple-ssa-evrp.c (evrp_dom_walker::before_dom_children): Adjust. * gimple-ssa-sprintf.c (get_int_range): Likewise. (format_integer): Likewise. (sprintf_dom_walker::handle_gimple_call): Likewise. * tree-ssa-dom.c (simplify_stmt_for_jump_threading): Likewise. * tree-vrp.c (vrp_prop::set_def_to_varying): Add. (vrp_prop::get_value_range): Adjust. (vrp_prop::vrp_initialize): Use set_def_to_varying instead of modifying the lattice in-place. (vrp_prop::visit_stmt): Likewise. * vr-values.c (vr_values::get_lattice_entry): New private method. (vr_values::get_value_range): Wrap it and return a const value_range *. (vr_values::set_def_to_varying): New. (vr_values::set_defs_to_varying): Use it. (vr_values::update_value_range): Likewise. (vr_values::vrp_stmt_computes_nonzero): Adjust. (values::op_with_constant_singleton_va): Likewise. (vr_values::extract_range_for_var_from_co): Likewise. (vr_values::extract_range_from_ssa_name): Likewise. (vr_values::extract_range_from_cond_expr): Likewise. (vr_values::extract_range_basic): Likewise. (compare_ranges): Take const value_range *, adjust. (compare_range_with_value): Likewise. (vrp_valueize): Adjust. (vrp_valueize_1): Likewise. (vr_values::get_vr_for_comparison): Return a const value_range *. (vr_values::compare_name_with_value): Adjust. (vr_values::compare_names): Likewise. (vr_values::vrp_evaluate_conditional_warnv_with_ops_using_ranges): Likewise. (vr_values::vrp_evaluate_conditional): Likewise. (find_case_label_ranges): Take a const value_range *. (vr_values::vrp_visit_switch_stmt): Adjust. (vr_values::extract_range_from_phi_node): Likewise. (vr_values::simplify_div_or_mod_using_ran): Likewise. (vr_values::simplify_abs_using_ranges): Likewise. (test_for_singularity): Take a const value_range *. (range_fits_type_p): Likewise. (vr_values::simplify_cond_using_ranges_1): Adjust. (vr_values::simplify_cond_using_ranges_2): Likewise. (vr_values::simplify_switch_using_ranges): Likewise. (vr_values::simplify_float_conversion_usi): Likewise. (vr_values::two_valued_val_range_p): Likewise. * vr-values.h (vr_values::get_value_range): Return a const value_range *. (vr_values::set_def_to_varying): New. (vr_values::get_lattice_entry): New private method. (vr_values::get_vr_for_comparison): Return a const value_range *. From-SVN: r273792
2019-07-12invoke.texi (ssa-name-def-chain-limit): Document new --param.Martin Sebor
gcc/ChangeLog: * doc/invoke.texi (ssa-name-def-chain-limit): Document new --param. * params.def (PARAM_SSA_NAME_DEF_CHAIN_LIMIT): Add new --param. * tree-vrp.c (vrp_prop::check_mem_ref): Use PARAM_SSA_NAME_DEF_CHAIN_LIMIT. gcc/testsuite/ChangeLog: * gcc.dg/Warray-bounds-43.c: New test. From-SVN: r273454
2019-07-11Do not try to further refine a VR_UNDEFINED result when intersectingAldy Hernandez
value_ranges. From-SVN: r273377
2019-06-13Revamp value_range::may_contain_p.Aldy Hernandez
From-SVN: r272238
2019-06-12Remove value_range_constant_singleton in favor of value_range::singleton_p.Aldy Hernandez
From-SVN: r272182
2019-06-07Split up value_range::intersect into base (value_range_base) andAldy Hernandez
derived versions (value_range). From-SVN: r272058
2019-06-03tree-vrp.h (value_range_base::nonzero_p): New.Aldy Hernandez
* tree-vrp.h (value_range_base::nonzero_p): New. (value_range_base::set_nonnull): Rename to... (value_range_base::set_nonzero): ...this. (value_range_base::set_null): Rename to... (value_range_base::set_zero): ...this. (value_range::set_nonnull): Remove. (value_range::set_null): Remove. * tree-vrp.c (range_is_null): Remove. (range_is_nonnull): Remove. (extract_range_from_binary_expr): Use value_range_base::*zero_p instead of range_is_*null. (extract_range_from_unary_expr): Same. (value_range_base::set_nonnull): Rename to... (value_range_base::set_nonzero): ...this. (value_range::set_nonnull): Remove. (value_range_base::set_null): Rename to... (value_range_base::set_zero): ...this. (value_range::set_null): Remove. (extract_range_from_binary_expr): Rename set_*null uses to set_*zero. (extract_range_from_unary_expr): Same. (union_helper): Same. * vr-values.c (get_value_range): Use set_*zero instead of set_*null. (vr_values::extract_range_from_binary_expr): Same. (vr_values::extract_range_basic): Same. From-SVN: r271865
2019-03-18PR tree-optimization/89720 - Spurious -Warray-bounds warning on a range with ↵Martin Sebor
max < min gcc/ChangeLog: PR tree-optimization/89720 * tree-vrp.c (vrp_prop::check_mem_ref): Treat range with max < min more conservatively, the same as anti-range. gcc/testsuite/ChangeLog: PR tree-optimization/89720 * gcc.dg/Warray-bounds-42.c: New test. From-SVN: r269785