summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dse.c
AgeCommit message (Collapse)Author
2020-03-17Fix up duplicated duplicated words mostly in commentsJakub Jelinek
In the r10-7197-gbae7b38cf8a21e068ad5c0bab089dedb78af3346 commit I've noticed duplicated word in a message, which lead me to grep for those and we have a tons of them. I've used grep -v 'long long\|optab optab\|template template\|double double' *.[chS] */*.[chS] *.def config/*/* 2>/dev/null | grep ' \([a-zA-Z]\+\) \1 ' Note, the command will not detect the doubled words at the start or end of line or when one of the words is at the end of line and the next one at the start of another one. Some of it is fairly obvious, e.g. all the "the the" cases which is something I've posted and committed patch for already e.g. in 2016, other cases are often valid, e.g. "that that" seems to look mostly ok to me. Some cases are quite hard to figure out, I've left out some of them from the patch (e.g. "and and" in some cases isn't talking about bitwise/logical and and so looks incorrect, but in other cases it is talking about those operations). In most cases the right solution seems to be to remove one of the duplicated words, but not always. I think most important are the ones with user visible messages (in the patch 3 of the first 4 hunks), the rest is just comments (and internal documentation; for that see the doc/tm.texi changes). 2020-03-17 Jakub Jelinek <jakub@redhat.com> * lra-spills.c (remove_pseudos): Fix up duplicated word issue in a dump message. * tree-sra.c (create_access_replacement): Fix up duplicated word issue in a comment. * read-rtl-function.c (find_param_by_name, function_reader::parse_enum_value, function_reader::get_insn_by_uid): Likewise. * spellcheck.c (get_edit_distance_cutoff): Likewise. * tree-data-ref.c (create_ifn_alias_checks): Likewise. * tree.def (SWITCH_EXPR): Likewise. * selftest.c (assert_str_contains): Likewise. * ipa-param-manipulation.h (class ipa_param_body_adjustments): Likewise. * tree-ssa-math-opts.c (convert_expand_mult_copysign): Likewise. * tree-ssa-loop-split.c (find_vdef_in_loop): Likewise. * langhooks.h (struct lang_hooks_for_decls): Likewise. * ipa-prop.h (struct ipa_param_descriptor): Likewise. * tree-ssa-strlen.c (handle_builtin_string_cmp, handle_store): Likewise. * tree-ssa-dom.c (simplify_stmt_for_jump_threading): Likewise. * tree-ssa-reassoc.c (reassociate_bb): Likewise. * tree.c (component_ref_size): Likewise. * hsa-common.c (hsa_init_compilation_unit_data): Likewise. * gimple-ssa-sprintf.c (get_string_length, format_string, format_directive): Likewise. * omp-grid.c (grid_process_kernel_body_copy): Likewise. * input.c (string_concat_db::get_string_concatenation, test_lexer_string_locations_ucn4): Likewise. * cfgexpand.c (pass_expand::execute): Likewise. * gimple-ssa-warn-restrict.c (builtin_memref::offset_out_of_bounds, maybe_diag_overlap): Likewise. * rtl.c (RTX_CODE_HWINT_P_1): Likewise. * shrink-wrap.c (spread_components): Likewise. * tree-ssa-dse.c (initialize_ao_ref_for_dse, valid_ao_ref_for_dse): Likewise. * tree-call-cdce.c (shrink_wrap_one_built_in_call_with_conds): Likewise. * dwarf2out.c (dwarf2out_early_finish): Likewise. * gimple-ssa-store-merging.c: Likewise. * ira-costs.c (record_operand_costs): Likewise. * tree-vect-loop.c (vectorizable_reduction): Likewise. * target.def (dispatch): Likewise. (validate_dims, gen_ccmp_first): Fix up duplicated word issue in documentation text. * doc/tm.texi: Regenerated. * config/i386/x86-tune.def (X86_TUNE_PARTIAL_FLAG_REG_STALL): Fix up duplicated word issue in a comment. * config/i386/i386.c (ix86_test_loading_unspec): Likewise. * config/i386/i386-features.c (remove_partial_avx_dependency): Likewise. * config/msp430/msp430.c (msp430_select_section): Likewise. * config/gcn/gcn-run.c (load_image): Likewise. * config/aarch64/aarch64-sve.md (sve_ld1r<mode>): Likewise. * config/aarch64/aarch64.c (aarch64_gen_adjusted_ldpstp): Likewise. * config/aarch64/falkor-tag-collision-avoidance.c (single_dest_per_chain): Likewise. * config/nvptx/nvptx.c (nvptx_record_fndecl): Likewise. * config/fr30/fr30.c (fr30_arg_partial_bytes): Likewise. * config/rs6000/rs6000-string.c (expand_cmp_vec_sequence): Likewise. * config/rs6000/rs6000-p8swap.c (replace_swapped_load_constant): Likewise. * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000.c (rs6000_option_override_internal): Likewise. * config/rs6000/rs6000-logue.c (rs6000_emit_probe_stack_range_stack_clash): Likewise. * config/nds32/nds32-md-auxiliary.c (nds32_split_ashiftdi3): Likewise. Fix various other issues in the comment. c-family/ * c-common.c (resolve_overloaded_builtin): Fix up duplicated word issue in a diagnostic message. cp/ * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message. (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue in a comment. * parser.c (cp_parser_statement, cp_parser_linkage_specification, cp_parser_placeholder_type_specifier, cp_parser_constraint_requires_parens): Likewise. * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise. fortran/ * array.c (gfc_check_iter_variable): Fix up duplicated word issue in a comment. * arith.c (gfc_arith_concat): Likewise. * resolve.c (gfc_resolve_ref): Likewise. * frontend-passes.c (matmul_lhs_realloc): Likewise. * module.c (gfc_match_submodule, load_needed): Likewise. * trans-expr.c (gfc_init_se): Likewise.
2020-03-12tree-dse: Fix mem* head trimming if call has lhs [PR94130]Jakub Jelinek
As the testcase shows, if DSE decides to head trim {mem{set,cpy,move},strncpy} and the call has lhs, it is incorrect to leave the lhs as is, because it will then point to the adjusted address (base + head_trim) instead of the original base. The following patch fixes that by dropping the lhs of the call and assigning lhs the original base in a following statement. 2020-03-12 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/94130 * tree-ssa-dse.c: Include gimplify.h. (increment_start_addr): If stmt has lhs, drop the lhs from call and set it after the call to the original value of the first argument. Formatting fixes. (decrement_count): Formatting fix. * gcc.c-torture/execute/pr94130.c: New test.
2020-03-03tree-optimization/93946 - fix bogus redundant store removal in FRE, DSE and DOMRichard Biener
This fixes a common mistake in removing a store that looks redudnant but is not because it changes the dynamic type of the memory and thus makes a difference for following loads with TBAA. 2020-03-03 Richard Biener <rguenther@suse.de> PR tree-optimization/93946 * alias.h (refs_same_for_tbaa_p): Declare. * alias.c (refs_same_for_tbaa_p): New function. * tree-ssa-alias.c (ao_ref_alias_set): For a NULL ref return zero. * tree-ssa-scopedtables.h (avail_exprs_stack::lookup_avail_expr): Add output argument giving access to the hashtable entry. * tree-ssa-scopedtables.c (avail_exprs_stack::lookup_avail_expr): Likewise. * tree-ssa-dom.c: Include alias.h. (dom_opt_dom_walker::optimize_stmt): Validate TBAA state before removing redundant store. * tree-ssa-sccvn.h (vn_reference_s::base_set): New member. (ao_ref_init_from_vn_reference): Adjust prototype. (vn_reference_lookup_pieces): Likewise. (vn_reference_insert_pieces): Likewise. * tree-ssa-sccvn.c: Track base alias set in addition to alias set everywhere. (eliminate_dom_walker::eliminate_stmt): Also check base alias set when removing redundant stores. (visit_reference_op_store): Likewise. * dse.c (record_store): Adjust valdity check for redundant store removal. * gcc.dg/torture/pr93946-1.c: New testcase. * gcc.dg/torture/pr93946-2.c: Likewise.
2020-01-15tree-optimization: Fix tree dse of __*_chk PR93262Jakub Jelinek
The following testcase shows that GCC trunk mishandles DSE of __*_chk calls. Tail trimming of the calls is fine, we want to just decrease the third argument and keep the first two and last arguments unmodified. But for head trimming, we currently increment the two by head_trim and decrease the third by head_trim, so __builtin___memcpy_chk (&a, b_2(D), 48, 32); __builtin_memset (&a, 32, 16); into: _5 = b_2(D) + 16; __builtin___memcpy_chk (&MEM <char> [(void *)&a + 16B], _5, 32, 32); __builtin_memset (&a, 32, 16); This is wrong, because the 32 was the determined (maximum) size of the destination (char a[32]), but &a[16] has maximum size of 16, not 32. The __builtin___memcpy_chk (&MEM <char> [(void *)&a + 16B], _5, 32, 32); call is just folded later into __builtin_memcpy (&MEM <char> [(void *)&a + 16B], _5, 32); because it says that it copies as many bytes into destination as the destination has. We need: __builtin___memcpy_chk (&MEM <char> [(void *)&a + 16B], _5, 32, 16); instead, which will terminate the program instead of letting it silently overflow the buffer. The patch just punts if we'd need to decrease the last argument below 0. Fortunately, release branches are unaffected. P.S. it was quite hard to make the runtime test working, in builtins.exp neither dg-options nor dg-additional-options work and builtins.exp adds -fno-tree-dse among several other -fno-* options. Fortunately optimize attribute works. 2020-01-15 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/93262 * tree-ssa-dse.c (maybe_trim_memstar_call): For *_chk builtins, perform head trimming only if the last argument is constant, either all ones, or larger or equal to head trim, in the latter case decrease the last argument by head_trim. * gcc.c-torture/execute/builtins/pr93262-chk.c: New test. * gcc.c-torture/execute/builtins/pr93262-chk-lib.c: New file. * gcc.c-torture/execute/builtins/pr93262-chk.x: New file.
2020-01-15tree-optimization: Fix tree dse of strncpy PR93249Jakub Jelinek
As the testcase shows, tail trimming of strncpy in tree-ssa-dse.c is fine, we just copy or clear fewer bytes in the destination, but unlike memcpy/memset etc., head trimming is problematic in certain cases. If we can prove that there are no zero bytes among initial head_trim bytes, it is ok to trim it, if we can prove there is at least one zero byte among initial head_trim bytes, we could (not implemented in the patch) turn the strncpy into memset 0, but otherwise we need to avoid the head trimming, because the presence or absence of NUL byte there changes the behavior for subsequent bytes, whether further bytes from src are copied or if further bytes are cleared. 2020-01-15 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/93249 * tree-ssa-dse.c: Include builtins.h and gimple-fold.h. (maybe_trim_memstar_call): Move head_trim and tail_trim vars to function body scope, reindent. For BUILTIN_IN_STRNCPY*, don't perform head trim unless we can prove there are no '\0' chars from the source among the first head_trim chars. * gcc.c-torture/execute/pr93249.c: New test.
2020-01-01Update copyright years.Jakub Jelinek
From-SVN: r279813
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-10-28re PR tree-optimization/92163 (ICE: Segmentation fault (in bitmap_set_bit))Prathamesh Kulkarni
2019-10-28 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> PR tree-optimization/92163 * tree-ssa-dse.c (delete_dead_or_redundant_assignment): New param need_eh_cleanup with default value NULL. Gate on need_eh_cleanup before calling bitmap_set_bit. (dse_optimize_redundant_stores): Pass global need_eh_cleanup to delete_dead_or_redundant_assignment. (dse_dom_walker::dse_optimize_stmt): Likewise. * tree-ssa-dse.h (delete_dead_or_redundant_assignment): Adjust prototype. testsuite/ * gcc.dg/tree-ssa/pr92163.c: New test. From-SVN: r277525
2019-10-11Do not allocate ggc during streaming.Jan Hubicka
* gimple-streamer-out.c (output_gimple_stmt): Add explicit function parameter. * lto-streamer-out.c: Include tree-dfa.h. (output_cfg): Do not use cfun. (lto_prepare_function_for_streaming): New. (output_function): Do not push cfun; do not initialize loop optimizer. * lto-streamer.h (lto_prepare_function_for_streaming): Declare. * passes.c (ipa_write_summaries): Use it. (ipa_write_optimization_summaries): Do not modify bodies. * tree-dfa.c (renumber_gimple_stmt_uids): Add function parameter. * tree.dfa.h (renumber_gimple_stmt_uids): Update prototype. * tree-ssa-dse.c (pass_dse::execute): Update use of renumber_gimple_stmt_uids. * tree-ssa-math-opts.c (pass_optimize_widening_mul::execute): Likewise. * lto.c (lto_wpa_write_files): Prepare all bodies for streaming. From-SVN: r276870
2019-10-07re PR tree-optimization/91532 ([SVE] Redundant predicated store in ↵Prathamesh Kulkarni
gcc.target/aarch64/fmla_2.c) 2019-10-07 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> Richard Biener <rguenther@suse.de> PR tree-optimization/91532 * tree-if-conv.c: Include tree-ssa-dse.h. (ifcvt_local_dce): Change param from bb to loop, and call dse_classify_store. (tree_if_conversion): Pass loop instead of loop->header as arg to ifcvt_local_dce. * tree-ssa-dse.c: Include tree-ssa-dse.h. (delete_dead_or_redundant_assignment): Remove static qualifier from declaration, and add prototype in tree-ssa-dse.h. (dse_store_status): Move to tree-ssa-dse.h. (dse_classify_store): Remove static qualifier and add new tree param stop_at_vuse, and add prototype in tree-ssa-dse.h. * tree-ssa-dse.h: New header. Co-Authored-By: Richard Biener <rguenther@suse.de> From-SVN: r276681
2019-08-20tree-ssa-dse.c (dse_optimize_redundant_stores): Improved check to catch more ↵Matthew Beliveau
redundant zero initialization cases. 2019-08-19 Matthew Beliveau <mbelivea@redhat.com> * tree-ssa-dse.c (dse_optimize_redundant_stores): Improved check to catch more redundant zero initialization cases. (dse_dom_walker::dse_optimize_stmt): Likewise. From-SVN: r274749
2019-07-19tree-ssa-dse.c (initialize_ao_ref_for_dse): Handle strncpy.Jeff Law
* tree-ssa-dse.c (initialize_ao_ref_for_dse): Handle strncpy. Drop some trivial dead code. (maybe_trim_memstar_call): Handle strncpy. * gcc.dg/tree-ssa/ssa-dse-37.c: New test. * gcc.dg/tree-ssa/ssa-dse-38.c: New test. From-SVN: r273606
2019-07-17tree-ssa-dse.c (initialize_ao_ref_for_dse): Fix formatting.Jeff Law
* tree-ssa-dse.c (initialize_ao_ref_for_dse): Fix formatting. (dse_walker::dse_optimize_stmt): Likewise. Add missing return to avoid unexpected switch statement fallthru. From-SVN: r273556
2019-06-27Fix ICE when __builtin_calloc has no LHS (PR tree-optimization/91014).Martin Liska
2019-06-27 Martin Liska <mliska@suse.cz> PR tree-optimization/91014 * tree-ssa-dse.c (initialize_ao_ref_for_dse): Bail out when LHS is NULL_TREE. 2019-06-27 Martin Liska <mliska@suse.cz> PR tree-optimization/91014 * gcc.target/s390/pr91014.c: New test. From-SVN: r272738
2019-06-26re PR tree-optimization/90883 (Generated code is worse if returned struct is ↵Jeff Law
unnamed) PR tree-optimization/90883 * tree-ssa-dse.c (delete_dead_or_redundant_call): Fix signature. (delete_dead_or_redundant_assignment): Likewise. From-SVN: r272726
2019-06-26re PR tree-optimization/90883 (Generated code is worse if returned struct is ↵Jeff Law
unnamed) PR tree-optimization/90883 * tree-ssa-alias.c (stmt_kills_ref_p): Handle BUILT_IN_CALLOC. * tree-ssa-dse.c: Update various comments to distinguish between dead and redundant stores. (initialize_ao_ref_for_dse): Handle BUILT_IN_CALLOC. (dse_optimize_redundant_stores): New function. (delete_dead_or_redundant_call): Renamed from delete_dead_call. Distinguish between dead and redundant calls in dump output. All callers updated. (delete_dead_or_redundant_assignment): Similarly for assignments. (dse_optimize_stmt): Handle _CHK variants. For statements which store 0 into multiple memory locations, try to prove a subsequent store is redundant. PR tree-optimization/90883 * g++.dg/tree-ssa/pr90883.C: New test. * gcc.dg/tree-ssa/ssa-dse-36.c: New test. From-SVN: r272717
2019-06-26tree-ssa-dse.c (initialize_ao_ref_for_dse): Handle _chk variants of memcpy, ↵Jeff Law
memmove and memset builtins. * tree-ssa-dse.c (initialize_ao_ref_for_dse): Handle _chk variants of memcpy, memmove and memset builtins. (maybe_trim_memstar_call): Likewise. * gcc.c-torture/execute/builtins/builtins.exp: Add -fno-tree-dse as DSE compromises several of these tests. * gcc.dg/builtin-stringop-chk-1.c: Similarly. * gcc.dg/memcpy-2.c: Similarly. * gcc.dg/pr40340-1.c: Similarly. * gcc.dg/pr40340-2.c: Similarly. * gcc.dg/pr40340-5.c: Similarly. From-SVN: r272704
2019-01-01Update copyright years.Jakub Jelinek
From-SVN: r267494
2018-08-27re PR tree-optimization/87110 ([9 Regresssion] tree check fail in to_wide, ↵Jeff Law
at tree.h:5523) PR tree-optimization/87110 * tree-ssa-dse.c (compute_trims): Handle non-constant TYPE_SIZE_UNIT. PR tree-optimization/87110 * gcc.c-torture/compile/pr87110.c: New test. From-SVN: r263906
2018-08-27tree-ssa-dse.c (compute_trims): Handle case where the reference's type does ↵Jeff Law
not have a TYPE_SIZE_UNIT. * tree-ssa-dse.c (compute_trims): Handle case where the reference's type does not have a TYPE_SIZE_UNIT. * gcc.c-torture/compile/dse.c: New test. From-SVN: r263896
2018-08-22tree-ssa-dse.c (compute_trims): Avoid folding away undefined behaviour.Bernd Edlinger
* tree-ssa-dse.c (compute_trims): Avoid folding away undefined behaviour. From-SVN: r263793
2018-07-17re PR tree-optimization/86010 (redundant memset with smaller size not ↵Jeff Law
eliminated) PR tree-optimization/86010 * tree-ssa-dse.c (compute_trims): Fix typo/thinko. From-SVN: r262841
2018-07-05re PR tree-optimization/86010 (redundant memset with smaller size not ↵Jeff Law
eliminated) PR tree-optimization/86010 * tree-ssa-dse.c (compute_trims): More aggressively trim at both the head and tail of mem* and str* calls. From-SVN: r262464
2018-05-17tree-ssa-dse.c (dse_classify_store): Fix iterator increment for pruning loop ↵Richard Biener
and prune defs feeding only already... 2018-05-17 Richard Biener <rguenther@suse.de> * tree-ssa-dse.c (dse_classify_store): Fix iterator increment for pruning loop and prune defs feeding only already visited PHIs. From-SVN: r260322
2018-05-17re PR tree-optimization/85757 (tree optimizers fail to fully clean up ↵Richard Biener
fixed-size memcpy) 2018-05-17 Richard Biener <rguenther@suse.de> PR tree-optimization/85757 * tree-ssa-dse.c (dse_classify_store): Record a PHI def and remove defs that only feed that PHI from further processing. * gcc.dg/tree-ssa/ssa-dse-34.c: New testcase. From-SVN: r260306
2018-05-16params.def (PARAM_DSE_MAX_ALIAS_QUERIES_PER_STORE): New param.Richard Biener
2018-05-16 Richard Biener <rguenther@suse.de> * params.def (PARAM_DSE_MAX_ALIAS_QUERIES_PER_STORE): New param. * doc/invoke.texi (dse-max-alias-queries-per-store): Document. * tree-ssa-dse.c: Include tree-ssa-loop.h. (check_name): New callback. (dse_classify_store): Track cycles via a visited bitmap of PHI defs and simplify handling of in-loop and across loop dead stores and properly fail for loop-variant refs. Handle byte-tracking with multiple defs. Use PARAM_DSE_MAX_ALIAS_QUERIES_PER_STORE for limiting the walk. * gcc.dg/tree-ssa/ssa-dse-32.c: New testcase. * gcc.dg/tree-ssa/ssa-dse-33.c: Likewise. * gcc.dg/uninit-pr81897-2.c: Use -fno-tree-dse. From-SVN: r260288
2018-05-15tree-ssa-dse.c (dse_classify_store): Remove use_stmt parameter, add ↵Richard Biener
by_clobber_p one. 2018-05-15 Richard Biener <rguenther@suse.de> * tree-ssa-dse.c (dse_classify_store): Remove use_stmt parameter, add by_clobber_p one. Change algorithm to collect all defs representing uses we need to walk and try reducing them to a single one before failing. (dse_dom_walker::dse_optimize_stmt): Adjust. * gcc.dg/tree-ssa/ssa-dse-31.c: New testcase. From-SVN: r260253
2018-01-03Update copyright years.Jakub Jelinek
From-SVN: r256169
2017-12-20poly_int: ao_ref and vn_reference_op_tRichard Sandiford
This patch changes the offset, size and max_size fields of ao_ref from HOST_WIDE_INT to poly_int64 and propagates the change through the code that references it. This includes changing the off field of vn_reference_op_struct in the same way. 2017-12-20 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * inchash.h (inchash::hash::add_poly_int): New function. * tree-ssa-alias.h (ao_ref::offset, ao_ref::size, ao_ref::max_size): Use poly_int64 rather than HOST_WIDE_INT. (ao_ref::max_size_known_p): New function. * tree-ssa-sccvn.h (vn_reference_op_struct::off): Use poly_int64_pod rather than HOST_WIDE_INT. * tree-ssa-alias.c (ao_ref_base): Apply get_ref_base_and_extent to temporaries until its interface is adjusted to match. (ao_ref_init_from_ptr_and_size): Handle polynomial offsets and sizes. (aliasing_component_refs_p, decl_refs_may_alias_p) (indirect_ref_may_alias_decl_p, indirect_refs_may_alias_p): Take the offsets and max_sizes as poly_int64s instead of HOST_WIDE_INTs. (refs_may_alias_p_1, stmt_kills_ref_p): Adjust for changes to ao_ref fields. * alias.c (ao_ref_from_mem): Likewise. * tree-ssa-dce.c (mark_aliased_reaching_defs_necessary_1): Likewise. * tree-ssa-dse.c (valid_ao_ref_for_dse, normalize_ref) (clear_bytes_written_by, setup_live_bytes_from_ref, compute_trims) (maybe_trim_complex_store, maybe_trim_constructor_store) (live_bytes_read, dse_classify_store): Likewise. * tree-ssa-sccvn.c (vn_reference_compute_hash, vn_reference_eq): (copy_reference_ops_from_ref, ao_ref_init_from_vn_reference) (fully_constant_vn_reference_p, valueize_refs_1): Likewise. (vn_reference_lookup_3): Likewise. * tree-ssa-uninit.c (warn_uninitialized_vars): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r255872
2017-11-01Make tree-ssa-dse.c:normalize_ref return a boolRichard Sandiford
This patch moves the check for an overlapping byte to normalize_ref from its callers, so that it's easier to convert to poly_ints later. It's not really worth it on its own. 2017-11-01 Richard Sandiford <richard.sandiford@linaro.org> gcc/ * tree-ssa-dse.c (normalize_ref): Check whether the ranges overlap and return false if not. (clear_bytes_written_by, live_bytes_read): Update accordingly. From-SVN: r254313
2017-10-16* tree-ssa-dse.c (live_bytes_read): Fix thinko.Jeff Law
From-SVN: r253792
2017-10-12re PR tree-optimization/82493 (UBSAN in gcc/sbitmap.c:368:28: runtime error: ↵Martin Liska
shift exponent 64 is too large for 64-bit type 'long unsigned int') PR tree-optimization/82493 * sbitmap.c (bitmap_bit_in_range_p): Fix the implementation. (test_range_functions): New function. (sbitmap_c_tests): Likewise. * selftest-run-tests.c (selftest::run_tests): Run new tests. * selftest.h (sbitmap_c_tests): New function. * tree-ssa-dse.c (live_bytes_read): Fix thinko. From-SVN: r253699
2017-10-12tree-ssa-dse.c (valid_ao_ref_for_dse): Reject ao_refs with negative offsets.Jeff Law
* tree-ssa-dse.c (valid_ao_ref_for_dse): Reject ao_refs with negative offsets. From-SVN: r253691
2017-10-02re PR tree-optimization/82387 (wrong code at -O1 and -Os on x86_64-linux-gnu ↵Jakub Jelinek
in 64-bit mode) PR tree-optimization/82387 PR tree-optimization/82388 PR tree-optimization/82389 * tree-ssa-dse.c (dse_classify_store): Test byte_tracking_enabled instead of live_bytes non-NULL. * gcc.c-torture/compile/pr82389.c: New test. * gcc.c-torture/execute/pr82387.c: New test. * gcc.c-torture/execute/pr82388.c: New test. From-SVN: r253356
2017-09-29sbitmap.c (bitmap_bit_in_range_p): New function.Jeff Law
* sbitmap.c (bitmap_bit_in_range_p): New function. * sbitmap.h (bitmap_bit_in_range_p): Prototype. * tree-ssa-dse.c (live_bytes_read): New function. (dse_classify_store): Ignore reads of dead bytes. * testsuite/gcc.dg/tree-ssa/ssa-dse-26.c: New test. From-SVN: r253305
2017-05-16Add default value for last argument of dump functions.Martin Liska
2017-05-16 Martin Liska <mliska@suse.cz> * parser.c (cp_lexer_print_token): Add default value for flags argument of print_gimple_stmt, print_gimple_expr, print_generic_stmt and print_generic_expr. 2017-05-16 Martin Liska <mliska@suse.cz> * cgraph.c (cgraph_edge::resolve_speculation): Add default value for flags argument of print_gimple_stmt, print_gimple_expr, print_generic_stmt and print_generic_expr. * cgraphclones.c (symbol_table::materialize_all_clones): Likewise. * coretypes.h: Likewise. * except.c (dump_eh_tree): Likewise. * gimple-fold.c (gimple_fold_stmt_to_constant_1): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-backprop.c (dump_usage_prefix): Likewise. (backprop::push_to_worklist): Likewise. (backprop::pop_from_worklist): Likewise. (backprop::process_use): Likewise. (backprop::intersect_uses): Likewise. (note_replacement): Likewise. * gimple-ssa-store-merging.c (pass_store_merging::terminate_all_aliasing_chains): Likewise. (imm_store_chain_info::coalesce_immediate_stores): Likewise. (pass_store_merging::execute): Likewise. * gimple-ssa-strength-reduction.c (dump_candidate): Likewise. (ssa_base_cand_dump_callback): Likewise. (dump_incr_vec): Likewise. (replace_refs): Likewise. (replace_mult_candidate): Likewise. (create_add_on_incoming_edge): Likewise. (create_phi_basis): Likewise. (insert_initializers): Likewise. (all_phi_incrs_profitable): Likewise. (introduce_cast_before_cand): Likewise. (replace_one_candidate): Likewise. * gimplify.c (gimplify_expr): Likewise. * graphite-isl-ast-to-gimple.c (is_valid_rename): Likewise. (set_rename): Likewise. (rename_uses): Likewise. (copy_loop_phi_nodes): Likewise. (add_close_phis_to_merge_points): Likewise. (copy_loop_close_phi_args): Likewise. (copy_cond_phi_args): Likewise. (graphite_copy_stmts_from_block): Likewise. (translate_pending_phi_nodes): Likewise. * graphite-poly.c (print_pdr): Likewise. (dump_gbb_cases): Likewise. (dump_gbb_conditions): Likewise. (print_scop_params): Likewise. * graphite-scop-detection.c (build_cross_bb_scalars_def): Likewise. (build_cross_bb_scalars_use): Likewise. (gather_bbs::before_dom_children): Likewise. * hsa-dump.c (dump_hsa_immed): Likewise. * ipa-cp.c (print_ipcp_constant_value): Likewise. (get_replacement_map): Likewise. * ipa-inline-analysis.c (dump_condition): Likewise. (estimate_function_body_sizes): Likewise. * ipa-polymorphic-call.c (check_stmt_for_type_change): Likewise. (ipa_polymorphic_call_context::get_dynamic_type): Likewise. * ipa-prop.c (ipa_dump_param): Likewise. (ipa_print_node_jump_functions_for_edge): Likewise. (ipa_modify_call_arguments): Likewise. (ipa_modify_expr): Likewise. (ipa_dump_param_adjustments): Likewise. (ipa_dump_agg_replacement_values): Likewise. (ipcp_modif_dom_walker::before_dom_children): Likewise. * ipa-pure-const.c (check_stmt): Likewise. (pass_nothrow::execute): Likewise. * ipa-split.c (execute_split_functions): Likewise. * omp-offload.c (dump_oacc_loop_part): Likewise. (dump_oacc_loop): Likewise. * trans-mem.c (tm_log_emit): Likewise. (tm_memopt_accumulate_memops): Likewise. (dump_tm_memopt_set): Likewise. (dump_tm_memopt_transform): Likewise. * tree-cfg.c (gimple_verify_flow_info): Likewise. (print_loop): Likewise. * tree-chkp-opt.c (chkp_print_addr): Likewise. (chkp_gather_checks_info): Likewise. (chkp_get_check_result): Likewise. (chkp_remove_check_if_pass): Likewise. (chkp_use_outer_bounds_if_possible): Likewise. (chkp_reduce_bounds_lifetime): Likewise. * tree-chkp.c (chkp_register_addr_bounds): Likewise. (chkp_mark_completed_bounds): Likewise. (chkp_register_incomplete_bounds): Likewise. (chkp_mark_invalid_bounds): Likewise. (chkp_maybe_copy_and_register_bounds): Likewise. (chkp_build_returned_bound): Likewise. (chkp_get_bound_for_parm): Likewise. (chkp_build_bndldx): Likewise. (chkp_get_bounds_by_definition): Likewise. (chkp_generate_extern_var_bounds): Likewise. (chkp_get_bounds_for_decl_addr): Likewise. * tree-chrec.c (chrec_apply): Likewise. * tree-data-ref.c (dump_data_reference): Likewise. (dump_subscript): Likewise. (dump_data_dependence_relation): Likewise. (analyze_overlapping_iterations): Likewise. * tree-inline.c (expand_call_inline): Likewise. (tree_function_versioning): Likewise. * tree-into-ssa.c (dump_defs_stack): Likewise. (dump_currdefs): Likewise. (dump_names_replaced_by): Likewise. (dump_update_ssa): Likewise. (update_ssa): Likewise. * tree-object-size.c (pass_object_sizes::execute): Likewise. * tree-parloops.c (build_new_reduction): Likewise. (try_create_reduction_list): Likewise. (ref_conflicts_with_region): Likewise. (oacc_entry_exit_ok_1): Likewise. (oacc_entry_exit_single_gang): Likewise. * tree-pretty-print.h: Likewise. * tree-scalar-evolution.c (set_scalar_evolution): Likewise. (get_scalar_evolution): Likewise. (add_to_evolution): Likewise. (get_loop_exit_condition): Likewise. (analyze_evolution_in_loop): Likewise. (analyze_initial_condition): Likewise. (analyze_scalar_evolution): Likewise. (instantiate_scev): Likewise. (number_of_latch_executions): Likewise. (gather_chrec_stats): Likewise. (final_value_replacement_loop): Likewise. (scev_const_prop): Likewise. * tree-sra.c (dump_access): Likewise. (disqualify_candidate): Likewise. (create_access): Likewise. (reject): Likewise. (maybe_add_sra_candidate): Likewise. (create_access_replacement): Likewise. (analyze_access_subtree): Likewise. (analyze_all_variable_accesses): Likewise. (sra_modify_assign): Likewise. (initialize_constant_pool_replacements): Likewise. (find_param_candidates): Likewise. (decide_one_param_reduction): Likewise. (replace_removed_params_ssa_names): Likewise. * tree-ssa-ccp.c (ccp_fold_stmt): Likewise. * tree-ssa-copy.c (dump_copy_of): Likewise. (copy_prop_visit_cond_stmt): Likewise. * tree-ssa-dce.c (mark_operand_necessary): Likewise. * tree-ssa-dom.c (pass_dominator::execute): Likewise. (record_equivalences_from_stmt): Likewise. * tree-ssa-dse.c (compute_trims): Likewise. (delete_dead_call): Likewise. (delete_dead_assignment): Likewise. * tree-ssa-forwprop.c (forward_propagate_into_gimple_cond): Likewise. (forward_propagate_into_cond): Likewise. (pass_forwprop::execute): Likewise. * tree-ssa-ifcombine.c (ifcombine_ifandif): Likewise. * tree-ssa-loop-im.c (invariantness_dom_walker::before_dom_children): Likewise. (move_computations_worker): Likewise. (execute_sm): Likewise. * tree-ssa-loop-ivcanon.c (tree_estimate_loop_size): Likewise. (remove_exits_and_undefined_stmts): Likewise. (remove_redundant_iv_tests): Likewise. * tree-ssa-loop-ivopts.c (dump_use): Likewise. (adjust_iv_update_pos): Likewise. * tree-ssa-math-opts.c (bswap_replace): Likewise. * tree-ssa-phiopt.c (factor_out_conditional_conversion): Likewise. (value_replacement): Likewise. * tree-ssa-phiprop.c (phiprop_insert_phi): Likewise. * tree-ssa-pre.c (print_pre_expr): Likewise. (get_representative_for): Likewise. (create_expression_by_pieces): Likewise. (insert_into_preds_of_block): Likewise. (eliminate_insert): Likewise. (eliminate_dom_walker::before_dom_children): Likewise. (eliminate): Likewise. (remove_dead_inserted_code): Likewise. * tree-ssa-propagate.c (substitute_and_fold): Likewise. * tree-ssa-reassoc.c (get_rank): Likewise. (eliminate_duplicate_pair): Likewise. (eliminate_plus_minus_pair): Likewise. (eliminate_not_pairs): Likewise. (undistribute_ops_list): Likewise. (eliminate_redundant_comparison): Likewise. (update_range_test): Likewise. (optimize_range_tests_var_bound): Likewise. (optimize_vec_cond_expr): Likewise. (rewrite_expr_tree): Likewise. (rewrite_expr_tree_parallel): Likewise. (linearize_expr): Likewise. (break_up_subtract): Likewise. (linearize_expr_tree): Likewise. (attempt_builtin_powi): Likewise. (attempt_builtin_copysign): Likewise. (transform_stmt_to_copy): Likewise. (transform_stmt_to_multiply): Likewise. (dump_ops_vector): Likewise. * tree-ssa-sccvn.c (vn_nary_build_or_lookup_1): Likewise. (print_scc): Likewise. (set_ssa_val_to): Likewise. (visit_reference_op_store): Likewise. (visit_use): Likewise. (sccvn_dom_walker::before_dom_children): Likewise. (run_scc_vn): Likewise. * tree-ssa-scopedtables.c (avail_exprs_stack::lookup_avail_expr): Likewise. (expr_hash_elt::print): Likewise. (const_and_copies::pop_to_marker): Likewise. (const_and_copies::record_const_or_copy_raw): Likewise. * tree-ssa-structalias.c (compute_dependence_clique): Likewise. * tree-ssa-uninit.c (collect_phi_def_edges): Likewise. (dump_predicates): Likewise. (find_uninit_use): Likewise. (warn_uninitialized_phi): Likewise. (pass_late_warn_uninitialized::execute): Likewise. * tree-ssa.c (verify_vssa): Likewise. (verify_ssa): Likewise. (maybe_optimize_var): Likewise. * tree-vrp.c (dump_value_range): Likewise. (dump_all_value_ranges): Likewise. (dump_asserts_for): Likewise. (register_edge_assert_for_2): Likewise. (vrp_visit_cond_stmt): Likewise. (vrp_visit_switch_stmt): Likewise. (vrp_visit_stmt): Likewise. (vrp_visit_phi_node): Likewise. (simplify_cond_using_ranges_1): Likewise. (fold_predicate_in): Likewise. (evrp_dom_walker::before_dom_children): Likewise. (evrp_dom_walker::push_value_range): Likewise. (evrp_dom_walker::pop_value_range): Likewise. (execute_early_vrp): Likewise. From-SVN: r248113
2017-05-14make a member an auto_sbitmapTrevor Saunders
gcc/ChangeLog: 2017-05-13 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * tree-ssa-dse.c (dse_dom_walker): Make m_live_byes a auto_sbitmap. From-SVN: r248024
2017-04-12re PR tree-optimization/80359 (DSE causes error: invalid reference prefix)Richard Biener
2017-04-12 Richard Biener <rguenther@suse.de> Jeff Law <law@redhat.com> PR tree-optimization/80359 * tree-ssa-dse.c (maybe_trim_partially_dead_store): Do not trim stores to TARGET_MEM_REFs. * gcc.dg/torture/pr80359.c: New testcase. Co-Authored-By: Jeff Law <law@redhat.com> From-SVN: r246875
2017-02-23re PR tree-optimization/79578 (Unnecessary instructions in generated code)Jeff Law
PR tree-optimization/79578 * tree-ssa-dse.c (clear_bytes_written_by): Use OEP_ADDRESS_OF in call to operand_equal_p. From-SVN: r245688
2017-02-22re PR tree-optimization/79578 (Unnecessary instructions in generated code)Jeff Law
PR tree-optimization/79578 * tree-ssa-dse.c (clear_bytes_written_by): Use operand_equal_p to compare base operands. PR tree-optimization/79578 * g++.dg/tree-ssa/ssa-dse-3.C: New test. From-SVN: r245675
2017-01-16re PR tree-optimization/79090 (DSE wrongly removes store at variable offset)Jeff Law
2017-01-16 Jeff Law <law@redhat.com> PR tree-optimization/79090 PR tree-optimization/33562 PR tree-optimization/61912 PR tree-optimization/77485 * tree-ssa-dse.c (compute_trims): Accept STMT argument. Dump STMT and computed trims into the dump file. PR tree-optimization/79090 PR tree-optimization/33562 PR tree-optimization/61912 PR tree-optimization/77485 * tree-ssa-dse.c (compute_trims): Accept STMT argument. Dump STMT and computed trims into the dump file. From-SVN: r244509
2017-01-15re PR tree-optimization/79090 (DSE wrongly removes store at variable offset)Jeff Law
PR tree-optimization/79090 * tree-ssa-dse.c (valid_ao_ref_for_dse): Reject zero length and variable length stores. (compute_trims): Delete dead assignment to *trim_tail. (dse_dom_walker::dse_optimize_stmt): Optimize mem* calls with zero length. From-SVN: r244472
2017-01-13Fix commentJeff Law
From-SVN: r244462
2017-01-13re PR tree-optimization/33562 (aggregate DSE disabled)Jeff Law
PR tree-optimization/33562 PR tree-optimization/61912 PR tree-optimization/77485 * tree-ssa-dse.c (delete_dead_call): Accept gsi rather than a statement. (delete_dead_assignment): Likewise. (dse_dom_walker::dse_optimize_stmt): Pass in the gsi rather than statement to delete_dead_call and delete_dead_assignment. From-SVN: r244461
2017-01-13tree-ssa-dse.c (decrement_count): New function.Jeff Law
* tree-ssa-dse.c (decrement_count): New function. (increment_start_addr, maybe_trim_memstar_call): Likewise. (dse_dom_walker::optimize_stmt): Call maybe_trim_memstar_call directly when we know the partially dead statement is a mem* function. * gcc.dg/tree-ssa/ssa-dse-25.c: New test. From-SVN: r244444
2017-01-13re PR middle-end/61912 (Missed (partial) dead store elimination for ↵Jeff Law
structures on GIMPLE) PR tree-optimization/61912 PR tree-optimization/77485 * tree-ssa-dse.c: Include expr.h. (maybe_trim_constructor_store): New function. (maybe_trim_partially_dead_store): Call maybe_trim_constructor_store. PR tree-optimization/61912 PR tree-optimization/77485 * g++.dg/tree-ssa/ssa-dse-1.C: New test. * gcc.dg/tree-ssa/pr30375: Adjust expected output. * gcc.dg/tree-ssa/ssa-dse-24.c: New test. From-SVN: r244443
2017-01-13re PR tree-optimization/33562 (aggregate DSE disabled)Jeff Law
PR tree-optimization/33562 PR tree-optimization/61912 PR tree-optimization/77485 * doc/invoke.texi: Document new dse-max-object-size param. * params.def (PARM_DSE_MAX_OBJECT_SIZE): New PARAM. * tree-ssa-dse.c: Include params.h. (dse_store_status): New enum. (initialize_ao_ref_for_dse): New, partially extracted from dse_optimize_stmt. (valid_ao_ref_for_dse, normalize_ref): New. (setup_live_bytes_from_ref, compute_trims): Likewise. (clear_bytes_written_by, maybe_trim_complex_store): Likewise. (maybe_trim_partially_dead_store): Likewise. (maybe_trim_complex_store): Likewise. (dse_classify_store): Renamed from dse_possibly_dead_store_p. Track what bytes live from the original store. Return tri-state for dead, partially dead or live. (dse_dom_walker): Add constructor, destructor and new private members. (delete_dead_call, delete_dead_assignment): New extracted from dse_optimize_stmt. (dse_optimize_stmt): Make a member of dse_dom_walker. Use initialize_ao_ref_for_dse. PR tree-optimization/33562 PR tree-optimization/61912 PR tree-optimization/77485 * gcc.dg/tree-ssa/complex-4.c: Remove xfail. * gcc.dg/tree-ssa/complex-5.c: Likewise. * gcc.dg/tree-ssa/ssa-dse-9.c: Likewise. * gcc.dg/tree-ssa/ssa-dse-18.c: New test. * gcc.dg/tree-ssa/ssa-dse-19.c: Likewise. * gcc.dg/tree-ssa/ssa-dse-20.c: Likewise. * gcc.dg/tree-ssa/ssa-dse-21.c: Likewise. From-SVN: r244442
2017-01-01Update copyright years.Jakub Jelinek
From-SVN: r243994
2016-11-14Fix dump output in dse_optimize_stmtMartin Liska
* tree-ssa-dse.c (dse_optimize_stmt): Remove quotes and extra new line. From-SVN: r242389