aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
AgeCommit message (Collapse)AuthorFilesLines
2020-04-15middle-end/94539 - void * aliases every other pointerRichard Biener1-1/+10
This makes same_type_for_tbaa_p conservative in the same way get_alias_set is about void * which we allow to alias all other pointers. 2020-04-15 Richard Biener <rguenther@suse.de> PR middle-end/94539 * tree-ssa-alias.c (same_type_for_tbaa): Defer to alias_sets_conflict_p for pointers. * gcc.dg/alias-14.c: Make dg-do run.
2020-03-03tree-optimization/93946 - fix bogus redundant store removal in FRE, DSE and DOMRichard Biener1-0/+2
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-02-27middle-end: Fix wrong code caused by disagreemed between FRE and access path ↵Jan Hubicka1-51/+127
oracle [PR 92152] FRE is checking stores for equivalence based on their address, value and base+ref alias sets. Because ref alias set is not always the alias set of innermost type, but it may be one of refs in the access path (as decided by component_uses_parent_alias_set_from) it means that we can not really rely on the remaining part of access path to be meaningful in any way except for offset+size computation. The patch makes alias (which is used by FRE to validate transform) and tree-ssa-alias to share same logic for ending the access path relevant for TBAA. tree-ssa-alias previously ended access paths on VIEW_CONVERT_EXPR and BIT_FIELD_REF so it is not hard to wire in common predicate. However it led to additional issues (I tried to read the code quite carefully for possible extra fun, so I hope I found it all): 1) alias_component_refs_walk compares base and reference sizes to see if one access path may continue by another. This check can be confused by an union containing structure with zero sized array. In this case we no longer see the refernece to zero sized array and think that ref size is 0. In an access path there can be at most one (valid) trailing/zero sized array access, so the sizes in the access path are decreasing with the this exception. This is already handled by the logic, however the access is not expected to happen past the end of TBAA segment. I suppose this was kind of latent problem before because one can think of access path doing traling array past VIEW_CONVERT_EXPR, but since in C code we don't VCE and in non-C we don't do trailing arrays, we did not hit the problem. I fixed this by tracking if the trailing array references appearing after the end of TBAA access path and mostly punt in the second case (because we need to support kind of all type puning here). I do not think we can assume much of sanity here, in particular, we no longer know there is only one because FRE may mix things up. An exception is the walk that looks for occurence of basetype of path1 within TBAA relevant part of path2. Here we realy care about TBAA relevant parts of paths and thus do not need to give up. I broke out the logic into ends_tbaa_access_path_p to avoid duplication and to let me stick some detailed comments. This became much more complex than I originally imagined (still it is useful to make oracle both faster and more precise). Note that logic in aliasing_component_refs_walk is safe since it works on TBAA relevant segments of paths only. 2) nonoverlapping_refs_since_match_p is using TBAA only in the corner case that the paths got out of sync and re-synchronize of types of same size are found. I thus extended it to whole paths (not only TBAA relevant parts) and track if the TBAA part can be used by counting of number of TBAA relevant res on the stack. I have noticed that in one case we call nonoverlapping_refs_since_match_p before checking for view converting MEM_REFs and in others we check after. I think we want to just disable TBAA part if view convert is in there but still disambiguate. I will do this incrementaly. 3) nonoverlapping_component_refs_p uses TBAA so it needs to punt on end of TBAA path. It deals with no sizes and thus there is not the issue as in 1). I am also attaching one (most probably) valid C++ testcase (by Mark Williams) where we incorrectly disambiguated while the code is valid by the common initial sequence rule. This happens to be fixed by same patch. Here one access goes through union and follows by access path trhough one filed, while other access path start by different field of the union with common initial sequence. This made aliasing_component_refs_p to not find the overlapping type (because there is none) and disambiguate. Now we cut the first access path by the union reference and this makes us to find the path continuation in alias_component_refs_walk. If FRE is ever made more careful about access paths past the fist union reference (I think that would be good idea since unions are quite common in C++ and we throw away quite useful info) then we will need to teach access path oracle about the common initial sequence rule (which, as Mark pointed out, is part of both C and C++ standards). Only argument that can possibly invalidate this testcase is that I do not see that stadnard is clear about the situation where one access path contains the union but other starts after the union. Clearly if both start after the union reference we are right to disambiguate (since there is no union unvolved). If both starts before union then there is common initial sequence and by standard it is defined. This case works on current trunk because aliasing_component_refs_p resorts to base+offset after finding the match. But even that is more or less an accident I would say. I had to xfail three testcases. While alias-access-path ones are artificial and odd, 20030807-7 is derived from gcc and shows that we give up on disambiguations of tree_node union, so this patch disables useful transform in real world code. I am still planning to collect some data on the effect of this change to TBAA, but unless we want to reorganize FRE, I do not think there is better solution. gcc/ChangeLog: 2020-02-26 Jan Hubicka <hubicka@ucw.cz> PR middle-end/92152 * alias.c (ends_tbaa_access_path_p): Break out from ... (component_uses_parent_alias_set_from): ... here. * alias.h (ends_tbaa_access_path_p): Declare. * tree-ssa-alias.c (access_path_may_continue_p): Break out from ...; handle trailing arrays past end of tbaa access path. (aliasing_component_refs_p): ... here; likewise. (nonoverlapping_refs_since_match_p): Track TBAA segment of the access path; disambiguate also past end of it. (nonoverlapping_component_refs_p): Use only TBAA segment of the access path. gcc/testsuite/ChangeLog: 2020-02-26 Jan Hubicka <hubicka@ucw.cz> PR middle-end/92152 * gcc.dg/tree-ssa/alias-access-path-12.c: New testcase. * g++.dg/torture/pr92152.C: New testcase. * gcc.dg/torture/pr92152.c: New testcase. * gcc.dg/tree-ssa/20030807-7.c: xfail. * gcc.dg/tree-ssa/alias-access-path-4.c: xfail one case. * gcc.dg/tree-ssa/alias-access-path-5.c: xfail one case.
2020-02-21tree-optimization: fix access path oracle on mismatched array refs [PR93586]Jan Hubicka1-4/+38
nonoverlapping_array_refs_p is not supposed to give meaningful results when bases of ref1 and ref2 are not same or completely disjoint and here it is called on c[0][j_2][0] and c[0][1] so bases in sence of this functions are "c[0][j_2]" and "c[0]" which do partially overlap. nonoverlapping_array_refs however walks pair of array references and in this case it misses to note the fact that if it walked across first mismatched pair it is no longer safe to compare rest. The reason why it continues matching is because it hopes it will eventually get pair of COMPONENT_REFs from types of same size and use TBAA to conclude that their addresses must be either same or completely disjoint. This patch makes the loop to terminate early but popping all the remaining pairs so walking can continue. We could re-synchronize on arrays of same size with TBAA but this is bit fishy (because we try to support some sort of partial array overlaps) and hard to implement (because of zero sized arrays and VLAs) so I think it is not worth the effort. In addition I notied that the function is not !flag_strict_aliasing safe and added early exits on places we set seen_unmatched_ref_p since later we do not check that in: /* If we skipped array refs on type of different sizes, we can no longer be sure that there are not partial overlaps. */ if (seen_unmatched_ref_p && !operand_equal_p (TYPE_SIZE (type1), TYPE_SIZE (type2), 0)) { ++alias_stats .nonoverlapping_refs_since_match_p_may_alias; } PR tree-optimization/93586 * tree-ssa-alias.c (nonoverlapping_array_refs_p): Finish array walk after mismatched array refs; do not sure type size information to recover from unmatched referneces with !flag_strict_aliasing_p. * gcc.dg/torture/pr93586.c: New testcase.
2020-02-11PR tree-optimization/93683 - ICE on calloc with unused return value in ↵Martin Sebor1-0/+2
ao_ref_init_from_ptr_and_size gcc/testsuite/ChangeLog: PR tree-optimization/93683 * gcc.dg/tree-ssa/ssa-dse-39.c: New test. gcc/ChangeLog: PR tree-optimization/93683 * tree-ssa-alias.c (stmt_kills_ref_p): Avoid using LHS when not set.
2020-02-05Fix up comment typo.Jakub Jelinek1-1/+1
2020-02-05 Jakub Jelinek <jakub@redhat.com> * tree-ssa-alias.c (aliasing_matching_component_refs_p): Fix up function comment typo.
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-10-24ipa-reference.c (ipa_reference_optimization_summary_d): Rename ↵Jan Hubicka1-6/+10
statics_not_read and statics_not_written to statics_read and... * ipa-reference.c (ipa_reference_optimization_summary_d): Rename statics_not_read and statics_not_written to statics_read and statics_written respectively. (no_module_statics): New static var. (ipa_reference_get_not_read_global): Rename to ... (ipa_reference_get_read_global): ... this. (ipa_reference_get_not_written_global): Rename to ... (ipa_reference_get_written_global): ... this. (dump_static_vars_set_to_file): Dump no_module_statics. (copy_static_var_set): Add for propagation parameter. (ipa_init): Initialize no_module_statics. (ipa_ref_opt_summary_t::duplicate): Update. (ipa_ref_opt_summary_t::remove): Update. (propagate): Update. (write_node_summary_p): Look correctly for bitmap differences. (ipa_reference_write_optimization_summary): Update. (ipa_reference_read_optimization_summary): Update. * ipa-reference.h (ipa_reference_get_not_read_global): Rename to ... (ipa_reference_get_read_global): ... this. (ipa_reference_get_not_written_global): Rename to ... (ipa_reference_get_written_global): ... this. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Update. (call_may_clobber_ref_p_1): Update. From-SVN: r277403
2019-10-20tree-ssa-alias.c (nonoverlapping_refs_since_match_p): Do not skip non-zero ↵Jan Hubicka1-6/+22
array accesses. * tree-ssa-alias.c (nonoverlapping_refs_since_match_p): Do not skip non-zero array accesses. * gcc.c-torture/execute/alias-access-path-2.c: New testcase. * gcc.dg/tree-ssa/alias-access-path-11.c: xfail. From-SVN: r277214
2019-10-01tree-ssa-alias.c (nonoverlapping_component_refs_since_match_p): Rename to ...Jan Hubicka1-63/+228
* tree-ssa-alias.c (nonoverlapping_component_refs_since_match_p): Rename to ... (nonoverlapping_refs_since_match_p): ... this; handle also ARRAY_REFs. (alias_stats): Update stats. (dump_alias_stats): Likewise. (cheap_array_ref_low_bound): New function. (aliasing_matching_component_refs_p): Add partial_overlap argument; pass it to nonoverlapping_refs_since_match_p. (aliasing_component_refs_walk): Update call of aliasing_matching_component_refs_p (nonoverlapping_array_refs_p): New function. (decl_refs_may_alias_p, indirect_ref_may_alias_decl_p, indirect_refs_may_alias_p): Update calls of nonoverlapping_refs_since_match_p. * gcc.dg/tree-ssa/alias-access-path-10.c: New testcase. * gcc.dg/tree-ssa/alias-access-path-11.c: New testcase. From-SVN: r276427
2019-09-16re PR tree-optimization/91756 (g++.dg/lto/alias-3 FAILs)Richard Biener1-11/+17
2019-09-16 Richard Biener <rguenther@suse.de> PR tree-optimization/91756 PR tree-optimization/87132 * tree-ssa-alias.h (enum translate_flags): New. (get_continuation_for_phi): Use it instead of simple bool flag. (walk_non_aliased_vuses): Likewise. * tree-ssa-alias.c (maybe_skip_until): Adjust. (get_continuation_for_phi): When looking across backedges only disallow valueization. (walk_non_aliased_vuses): Adjust. * tree-ssa-sccvn.c (vn_reference_lookup_3): Avoid valueization if requested. * gcc.dg/tree-ssa/ssa-fre-81.c: New testcase. From-SVN: r275747
2019-07-15tree-ssa-alias.c (aliasing_component_refs_walk): Initialize same_p to 0.Jan Hubicka1-1/+1
* tree-ssa-alias.c (aliasing_component_refs_walk): Initialize same_p to 0. From-SVN: r273495
2019-07-13tree-ssa-alias.c (component_ref_to_zero_sized_trailing_array_p): Break out ↵Jan Hubicka1-98/+107
from ... * tree-ssa-alias.c (component_ref_to_zero_sized_trailing_array_p): Break out from ... (aliasing_component_refs_walk): Break out from ... (aliasing_component_refs_p): ... here. From-SVN: r273469
2019-07-12tree-ssa-alias.c (same_tmr_indexing_p): Break out from ...Jan Hubicka1-23/+20
* tree-ssa-alias.c (same_tmr_indexing_p): Break out from ... (indirect_refs_may_alias_p): ... here. (nonoverlapping_component_refs_since_match_p): Support also non-trivial mem refs in the access paths. * gcc.dg/tree-ssa/alias-access-path-9.c: New testcase. From-SVN: r273451
2019-07-10tree-ssa-alias.c (nonoverlapping_component_refs_p_1): Break out from ...; ↵Jan Hubicka1-59/+147
work also on duplicated types. * tree-ssa-alias.c (nonoverlapping_component_refs_p_1): Break out from ...; work also on duplicated types. (nonoverlapping_component_refs_since_match): ... here (ncr_type_uid): Break out from ... (ncr_compar): ... here; look for TYPE_UID of canonical type if available. (nonoverlapping_component_refs_p): Use same_type_for_tbaa to match the types and nonoverlapping_component_refs_p_1 to disambiguate. * g++.dg/lto/alias-3_0.C: New file. * g++.dg/lto/alias-3_1.c: New file. From-SVN: r273322
2019-07-05re PR tree-optimization/91091 ([missed optimization] Missing optimization in ↵Richard Biener1-9/+10
unaliased pointers) 2019-07-05 Richard Biener <rguenther@suse.de> PR tree-optimization/91091 * tree-ssa-alias.h (get_continuation_for_phi): Add tbaa_p parameter. (walk_non_aliased_vuses): Likewise. * tree-ssa-alias.c (maybe_skip_until): Pass down tbaa_p. (get_continuation_for_phi): New tbaa_p parameter and pass it down. (walk_non_aliased_vuses): Likewise. * ipa-prop.c (determine_known_aggregate_parts): Adjust. * tree-ssa-pre.c (translate_vuse_through_block): Likewise. * tree-ssa-scopedtables.c (avail_exprs_stack::lookup_avail_expr): Likewise. * tree-ssa-sccvn.c (struct vn_walk_cb_data): Add tbaa_p flag. (adjust_offsets_for_equal_base_address): New function. (vn_reference_lookup_3): Use it to catch more base equivalences. Handle and pass down tbaa_p flag. (vn_reference_lookup_pieces): Adjust. (vn_reference_lookup): Remove alias-set altering, instead pass down false as tbaa_p. * gcc.dg/tree-ssa/pr91091-2.c: New testcase. * gcc.dg/tree-ssa/ssa-fre-70.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-71.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-72.c: Likewise. From-SVN: r273135
2019-07-05tree-ssa-alias.c (alias_stats): Add ↵Jan Hubicka1-10/+27
nonoverlapping_component_refs_since_match_p_must_overlap. * tree-ssa-alias.c (alias_stats): Add nonoverlapping_component_refs_since_match_p_must_overlap. (dump_alias_stats): Print it. (nonoverlapping_component_refs_since_match_p): Add early exit. (nonoverlapping_component_refs_p): Do not account early exit. From-SVN: r273133
2019-07-04tree-ssa-alias.c (nonoverlapping_component_refs_since_match_p): Fix check ↵Jan Hubicka1-6/+2
for match in the ref walk. * tree-ssa-alias.c (nonoverlapping_component_refs_since_match_p): Fix check for match in the ref walk. From-SVN: r273090
2019-07-04tree-ssa-alias.c (decl_refs_may_alias_p): Add size1 and size2 parameters; ↵Jan Hubicka1-8/+46
return early for must-alias. * tree-ssa-alias.c (decl_refs_may_alias_p): Add size1 and size2 parameters; return early for must-alias. (indirect_ref_may_alias_decl_p): Likewise; when establishing outer types match, try nonoverlapping_component_refs if must-alias is not obvious. (indirect_refs_may_alias_p): Likewise. (refs_may_alias_p_2): Likewise. * gcc.dg/tree-ssa/alias-access-path-3.c: New testcase. * gcc.dg/tree-ssa/alias-access-path-8.c: New testcase. From-SVN: r273079
2019-07-02tree-ssa-alias.c (aliasing_component_refs_p): Remove forgotten sanity check.Jan Hubicka1-2/+0
* tree-ssa-alias.c (aliasing_component_refs_p): Remove forgotten sanity check. From-SVN: r272927
2019-07-02tree-ssa-alias.c (nonoverlapping_component_refs_for_decl_p): Rename to ..Jan Hubicka1-97/+162
* tree-ssa-alias.c (nonoverlapping_component_refs_for_decl_p): Rename to .. (nonoverlapping_component_refs_since_match_p): ... this one; handle also non-decl bases; return -1 if search gave up. (alias_stats): Rename nonoverlapping_component_refs_of_decl_p_may_alias, nonoverlapping_component_refs_of_decl_p_no_alias to nonoverlapping_component_refs_since_match_p_may_alias, nonoverlapping_component_refs_since_match_p_no_alias. (dump_alias_stats): Update dumping. (aliasing_matching_component_refs_p): Break out from ...; dispatch to nonoverlapping_component_refs_for_decl_p and nonoverlapping_component_refs_since_match_p. (aliasing_component_refs_p): ... here; call nonoverlapping_component_refs_p in scenarios where we can not precisely determine base match. (decl_refs_may_alias_p): Use nonoverlapping_component_refs_since_match_p. (indirect_ref_may_alias_decl_p): Do not call nonoverlapping_component_refs_p. (indirect_refs_may_alias_p): Likewise. * gcc.dg/tree-ssa/alias-access-path-7.c: New testcase. From-SVN: r272926
2019-06-26re PR tree-optimization/90883 (Generated code is worse if returned struct is ↵Jeff Law1-2/+25
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-25tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Check that base2_alias_set ↵Jan Hubicka1-3/+4
is non-zero before doing TBAA based disambiguation. * tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Check that base2_alias_set is non-zero before doing TBAA based disambiguation. From-SVN: r272639
2019-06-24re PR tree-optimization/90930 (Excessive memory consumption)Richard Biener1-0/+1
2019-06-24 Richard Biener <rguenther@suse.de> PR tree-optimization/90930 PR tree-optimization/90316 * tree-ssa-alias.c (walk_non_aliased_vuses): Add missing decrement of limit. From-SVN: r272621
2019-06-22alias-access-path-6.c: New testcase.Jan Hubicka1-9/+6
* gcc.dg/tree-ssa/alias-access-path-6.c: New testcase. * tree-ssa-alias.c (nonoverlapping_component_refs_p): Do not give up on bitfields; continue searching for different refs appearing later. From-SVN: r272587
2019-06-20tree-ssa-alias.c (aliasing_component_refs_p): Remove ref2_is_decl parameter; ↵Jan Hubicka1-16/+7
it has no use in gimple memory model. * tree-ssa-alias.c (aliasing_component_refs_p): Remove ref2_is_decl parameter; it has no use in gimple memory model. (indirect_ref_may_alias_decl_p): Update. * gcc.c-torture/execute/alias-access-path-1.c: New testcase. From-SVN: r272510
2019-06-17re PR bootstrap/90873 (-Wmaybe-uninitialized warning in ↵Jan Hubicka1-1/+1
gcc/tree-ssa-forwprop.c breaks 32-bit bootstrap) PR bootstrap/90873. * tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Fix TMR index check. From-SVN: r272390
2019-06-17tree-ssa-alias.c (aliasing_component_refs_p): Consider only the access path ↵Jan Hubicka1-17/+22
from base to first VIEW_CONVERT_EXPR or BIT_FIELD_REF. * tree-ssa-alias.c (aliasing_component_refs_p): Consider only the access path from base to first VIEW_CONVERT_EXPR or BIT_FIELD_REF. From-SVN: r272383
2019-06-17tree-ssa-alias.c (nonoverlapping_component_refs_p): Also truncate access ↵Jan Hubicka1-2/+4
path on BIT_FIELD_REFs. * tree-ssa-alias.c (nonoverlapping_component_refs_p): Also truncate access path on BIT_FIELD_REFs. From-SVN: r272380
2019-06-16tree-ssa-alias.c (indirect_ref_may_alias_decl_p, [...]): Revert accidental ↵Jan Hubicka1-9/+6
commits. * tree-ssa-alias.c (indirect_ref_may_alias_decl_p, indirect_refs_may_alias_p): Revert accidental commits. From-SVN: r272358
2019-06-16alias-access-path-4.c: New testcase.Jan Hubicka1-12/+70
* gcc.dg/tree-ssa/alias-access-path-4.c: New testcase. * gcc.dg/tree-ssa/alias-access-path-5.c: New testcase. * tree-ssa-alias.c (aliasing_component_refs_p): Watch for arrays at the end of structures. From-SVN: r272357
2019-06-16tree-ssa-alias.c (nonoverlapping_component_refs_p): Fix pasto in my previous ↵Jan Hubicka1-1/+1
patch. * tree-ssa-alias.c (nonoverlapping_component_refs_p): Fix pasto in my previous patch. From-SVN: r272354
2019-06-15alias-access-path-2.c: New testcase.Jan Hubicka1-29/+106
* gcc.dg/tree-ssa/alias-access-path-2.c: New testcase. * tree-ssa-alias.c (alias_stats): Add nonoverlapping_component_refs_p_may_alias, nonoverlapping_component_refs_p_no_alias, nonoverlapping_component_refs_of_decl_p_may_alias, nonoverlapping_component_refs_of_decl_p_no_alias. (dump_alias_stats): Dump them. (nonoverlapping_component_refs_of_decl_p): Add stats. (nonoverlapping_component_refs_p): Add stats; do not stop on first ARRAY_REF. From-SVN: r272329
2019-06-13re PR bootstrap/90873 (-Wmaybe-uninitialized warning in ↵Jan Hubicka1-1/+3
gcc/tree-ssa-forwprop.c breaks 32-bit bootstrap) PR bootstrap/90873 * tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Also check that dbase is not TARGET_MEM_REF. From-SVN: r272273
2019-06-13re PR tree-optimization/90869 (Non-disambiguated memory accesses)Jan Hubicka1-5/+16
PR tree-optimize/90869 * tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Watch for view converts in MEM_REF referencing decl rather than view converts from decl type to MEM_REF type. * g++.dg/tree-ssa/alias-access-path-1.C: New testcase. From-SVN: r272247
2019-06-07Make aliasing_component_refs_p to work harder when same_type_for_tbaa returns -1Jan Hubicka1-18/+57
* tree-ssa-alias.c (aliasing_component_refs_p): Do not give up immediately after same_types_for_tbaa_p returns -1 and continue looking for possible exact match; if matching types are arrays watch for partial overlaps. (indirect_ref_may_alias_decl_p): Watch for partial array overlaps. (indirect_refs_may_alias_p): Do type based disambiguation first; update comment. * gcc.dg/lto/alias-access-path-2.0.c: New testcase. From-SVN: r272036
2019-06-04re PR fortran/90738 (gfortran.dg/pointer_array_10.f90 etc. FAIL)Richard Biener1-4/+2
2019-06-04 Richard Biener <rguenther@suse.de> PR tree-optimization/90738 Revert 2019-06-03 Richard Biener <rguenther@suse.de> * tree-ssa-sccvn.c (ao_ref_init_from_vn_reference): Get original full reference tree and record in ref->ref. (vn_reference_lookup_3): Pass in original ref to ao_ref_init_from_vn_reference. (vn_reference_lookup): Likewise. * tree-ssa-sccvn.h (ao_ref_init_from_vn_reference): Adjust prototype. * tree-ssa-alias.c (nonoverlapping_component_refs_of_decl_p): Handle non-decl bases in the original reference. * gcc.dg/tree-ssa/alias-access-path-1.c: Scan fre1. * gcc.dg/torture/pr90738.c: New testcase. From-SVN: r271902
2019-06-03tree-ssa-sccvn.c (ao_ref_init_from_vn_reference): Get original full ↵Richard Biener1-2/+4
reference tree and record in ref->ref. 2019-06-03 Richard Biener <rguenther@suse.de> * tree-ssa-sccvn.c (ao_ref_init_from_vn_reference): Get original full reference tree and record in ref->ref. (vn_reference_lookup_3): Pass in original ref to ao_ref_init_from_vn_reference. (vn_reference_lookup): Likewise. * tree-ssa-sccvn.h (ao_ref_init_from_vn_reference): Adjust prototype. * tree-ssa-alias.c (nonoverlapping_component_refs_of_decl_p): Handle non-decl bases in the original reference. * gcc.dg/tree-ssa/alias-access-path-1.c: Scan fre1. From-SVN: r271860
2019-05-31tree-ssa-alias.c (type_has_components_p): New function.Jan Hubicka1-0/+12
* tree-ssa-alias.c (type_has_components_p): New function. (aliasing_component_refs_p): Use it. From-SVN: r271813
2019-05-29tree-ssa-alias.c (same_type_for_tbaa): Return ture if main variants are ↵Jan Hubicka1-0/+4
pointer equivalent. * tree-ssa-alias.c (same_type_for_tbaa): Return ture if main variants are pointer equivalent. From-SVN: r271747
2019-05-23re PR tree-optimization/90576 (SPEC CPU2006 450.soplex miscompiled with -Os ↵Jan Hubicka1-8/+13
-flto after r271413) PR tree-optimization/90576 * tree-ssa-alias.c (compare_sizes): Remove dead calls to poly_int_tree_p. (aliasing_component_refs_p): Fix three way size compare conditional; give up earlier in case we can not decide on equivalence. Co-Authored-By: Martin Liska <mliska@suse.cz> From-SVN: r271572
2019-05-20tree-ssa-alias.c (refs_may_alias_p_2): Break out from ...Jan Hubicka1-9/+17
* tree-ssa-alias.c (refs_may_alias_p_2): Break out from ... (refs_may_alias_p_1): ... here; update stats. (refs_may_alias_p): Do not update stats here. From-SVN: r271419
2019-05-20tree-ssa-alias.c (compare_sizes): New function.Jan Hubicka1-57/+128
* tree-ssa-alias.c (compare_sizes): New function. (sompare_type_sizes): New function (aliasing_component_refs_p): Use it. (indirect_ref_may_alias_decl_p): Likewise. From-SVN: r271413
2019-05-16tree-ssa-alias.c (alias_stats): Add aliasing_component_refs_p_may_alias and ↵Jan Hubicka1-8/+44
aliasing_component_refs_p_no_alias. * tree-ssa-alias.c (alias_stats): Add aliasing_component_refs_p_may_alias and aliasing_component_refs_p_no_alias. (dump_alias_stats): Print aliasing_component_refs_p stats. (aliasing_component_refs_p): Update stats. From-SVN: r271292
2019-05-07re PR tree-optimization/90316 (large compile time increase in opt / alias ↵Richard Biener1-12/+23
stmt walking for Go example) 2019-05-07 Richard Biener <rguenther@suse.de> PR tree-optimization/90316 * tree-ssa-alias.h (get_continuation_for_phi): Take walking limit by reference. (walk_non_aliased_vuses): Take walking limit argument. * tree-ssa-alias.c (maybe_skip_until): Take limit and abort walking if it is reached instead of just counting. (get_continuation_for_phi): Likewise. (walk_non_aliased_vuses): Likewise, instead of leaving counter limiting to the callback. * tree-ssa-sccvn.c (vn_reference_lookup_2): Adjust. (vn_reference_lookup_3): Likewise. (vn_reference_lookup_pieces): Likewise. (vn_reference_lookup): Likewise. * tree-ssa-pre.c (translate_vuse_through_block): Limit walking. * tree-ssa-scopedtables.c (vuse_eq): Adjust. (avail_exprs_stack::lookup_avail_expr): Likewise. From-SVN: r270940
2019-05-07tree-ssa-alias.c (aliasing_component_refs_p): Continue looking for ↵Jan Hubicka1-11/+13
comparaible types in the second direction even if... * tree-ssa-alias.c (aliasing_component_refs_p): Continue looking for comparaible types in the second direction even if first one hits incomparable type. From-SVN: r270938
2019-05-06re PR tree-optimization/90316 (large compile time increase in opt / alias ↵Richard Biener1-39/+20
stmt walking for Go example) 2019-05-06 Richard Biener <rguenther@suse.de> PR tree-optimization/90316 * tree-ssa-alias.c (maybe_skip_until): Pass in target BB, compute target on demand. (get_continuation_for_phi): Remove code walking stmts to get to a target virtual operand which could end up being quadratic. From-SVN: r270902
2019-01-17gimple-ssa-isolate-paths.c (stmt_uses_name_in_undefined_way): Replace ↵Eric Botcazou1-1/+1
flag_non_call_exceptions with cfun->can_throw_non_call_exceptions. * gimple-ssa-isolate-paths.c (stmt_uses_name_in_undefined_way): Replace flag_non_call_exceptions with cfun->can_throw_non_call_exceptions. (stmt_uses_0_or_null_in_undefined_way): Likewise. * tree-ssa-alias.c (same_addr_size_stores_p): Likewise. From-SVN: r268018
2019-01-09PR other/16615 [1/5]Sandra Loosemore1-1/+1
2019-01-09 Sandra Loosemore <sandra@codesourcery.com> PR other/16615 [1/5] contrib/ * mklog: Mechanically replace "can not" with "cannot". gcc/ * Makefile.in: Mechanically replace "can not" with "cannot". * alias.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine-stack-adj.c: Likewise. * combine.c: Likewise. * common/config/i386/i386-common.c: Likewise. * config/aarch64/aarch64.c: Likewise. * config/alpha/sync.md: Likewise. * config/arc/arc.c: Likewise. * config/arc/predicates.md: Likewise. * config/arm/arm-c.c: Likewise. * config/arm/arm.c: Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/cortex-r4f.md: Likewise. * config/csky/csky.c: Likewise. * config/csky/csky.h: Likewise. * config/darwin-f.c: Likewise. * config/epiphany/epiphany.md: Likewise. * config/i386/i386.c: Likewise. * config/i386/sol2.h: Likewise. * config/m68k/m68k.c: Likewise. * config/mcore/mcore.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/mips/20kc.md: Likewise. * config/mips/sb1.md: Likewise. * config/nds32/nds32.c: Likewise. * config/nds32/predicates.md: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/e300c2c3.md: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.h: Likewise. * config/sh/sh.c: Likewise. * config/sh/sh.md: Likewise. * config/spu/vmx2spu.h: Likewise. * cprop.c: Likewise. * dbxout.c: Likewise. * df-scan.c: Likewise. * doc/cfg.texi: Likewise. * doc/extend.texi: Likewise. * doc/fragments.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/lto.texi: Likewise. * doc/md.texi: Likewise. * doc/objc.texi: Likewise. * doc/rtl.texi: Likewise. * doc/tm.texi: Likewise. * dse.c: Likewise. * emit-rtl.c: Likewise. * emit-rtl.h: Likewise. * except.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * fold-const.c: Likewise. * genautomata.c: Likewise. * gimple-fold.c: Likewise. * hard-reg-set.h: Likewise. * ifcvt.c: Likewise. * ipa-comdats.c: Likewise. * ipa-cp.c: Likewise. * ipa-devirt.c: Likewise. * ipa-fnsummary.c: Likewise. * ipa-icf.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-polymorphic-call.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-visibility.c: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * ira.h: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-assigns.c: Likewise. * lra-constraints.c: Likewise. * lra-eliminations.c: Likewise. * lra-lives.c: Likewise. * lra-remat.c: Likewise. * lra-spills.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-streamer-out.c: Likewise. * postreload-gcse.c: Likewise. * predict.c: Likewise. * profile-count.h: Likewise. * profile.c: Likewise. * recog.c: Likewise. * ree.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.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. * simplify-rtx.c: Likewise. * symtab.c: Likewise. * target.def: Likewise. * toplev.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-core.h: Likewise. * tree-eh.c: Likewise. * tree-inline.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-nrv.c: Likewise. * tree-profile.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-phionlycprop.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssanames.c: Likewise. * tree-streamer-out.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * vr-values.c: Likewise. gcc/ada/ * exp_ch9.adb: Mechanically replace "can not" with "cannot". * libgnat/s-regpat.ads: Likewise. * par-ch4.adb: Likewise. * set_targ.adb: Likewise. * types.ads: Likewise. gcc/cp/ * cp-tree.h: Mechanically replace "can not" with "cannot". * parser.c: Likewise. * pt.c: Likewise. gcc/fortran/ * class.c: Mechanically replace "can not" with "cannot". * decl.c: Likewise. * expr.c: Likewise. * gfc-internals.texi: Likewise. * intrinsic.texi: Likewise. * invoke.texi: Likewise. * io.c: Likewise. * match.c: Likewise. * parse.c: Likewise. * primary.c: Likewise. * resolve.c: Likewise. * symbol.c: Likewise. * trans-array.c: Likewise. * trans-decl.c: Likewise. * trans-intrinsic.c: Likewise. * trans-stmt.c: Likewise. gcc/go/ * go-backend.c: Mechanically replace "can not" with "cannot". * go-gcc.cc: Likewise. gcc/lto/ * lto-partition.c: Mechanically replace "can not" with "cannot". * lto-symtab.c: Likewise. * lto.c: Likewise. gcc/objc/ * objc-act.c: Mechanically replace "can not" with "cannot". libbacktrace/ * backtrace.h: Mechanically replace "can not" with "cannot". libgcc/ * config/c6x/libunwind.S: Mechanically replace "can not" with "cannot". * config/tilepro/atomic.h: Likewise. * config/vxlib-tls.c: Likewise. * generic-morestack-thread.c: Likewise. * generic-morestack.c: Likewise. * mkmap-symver.awk: Likewise. libgfortran/ * caf/single.c: Mechanically replace "can not" with "cannot". * io/unit.c: Likewise. libobjc/ * class.c: Mechanically replace "can not" with "cannot". * objc/runtime.h: Likewise. * sendmsg.c: Likewise. liboffloadmic/ * include/coi/common/COIResult_common.h: Mechanically replace "can not" with "cannot". * include/coi/source/COIBuffer_source.h: Likewise. libstdc++-v3/ * include/ext/bitmap_allocator.h: Mechanically replace "can not" with "cannot". From-SVN: r267783
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494