diff options
author | Richard Biener <rguenther@suse.de> | 2016-11-07 12:26:00 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-11-07 12:26:00 +0000 |
commit | 20770eb80bf59f4fe1d71408b841669c70550e6c (patch) | |
tree | 40cda2f82959c26f706bbc6c773b5682bba61a36 /gcc | |
parent | 32894793ff96f4c56b90e0f0e1d961e526a6edc7 (diff) | |
download | gcc-20770eb80bf59f4fe1d71408b841669c70550e6c.zip gcc-20770eb80bf59f4fe1d71408b841669c70550e6c.tar.gz gcc-20770eb80bf59f4fe1d71408b841669c70550e6c.tar.bz2 |
re PR tree-optimization/78218 (wrong code at -Os and above on x86_64-linux-gnu (in both 32-bit and 64-bit modes))
2016-11-07 Richard Biener <rguenther@suse.de>
PR tree-optimization/78218
* gimple-ssa-store-merging.c
(pass_store_merging::terminate_all_aliasing_chains):
Drop unused argument, fix alias check to also consider uses.
(pass_store_merging::execute): Adjust.
* gcc.dg/torture/pr78218.c: New testcase.
From-SVN: r241900
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/gimple-ssa-store-merging.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr78218.c | 24 |
4 files changed, 46 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 262f006..5ccd3b4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2016-11-07 Richard Biener <rguenther@suse.de> + PR tree-optimization/78218 + * gimple-ssa-store-merging.c + (pass_store_merging::terminate_all_aliasing_chains): + Drop unused argument, fix alias check to also consider uses. + (pass_store_merging::execute): Adjust. + +2016-11-07 Richard Biener <rguenther@suse.de> + PR tree-optimization/78228 * tree-ssa-phiopt.c (abs_replacement): Avoid introducing undefined behavior. diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c index 36bc833..57b8556 100644 --- a/gcc/gimple-ssa-store-merging.c +++ b/gcc/gimple-ssa-store-merging.c @@ -726,7 +726,7 @@ private: hash_map<tree_operand_hash, struct imm_store_chain_info *> m_stores; bool terminate_and_process_all_chains (); - bool terminate_all_aliasing_chains (tree, imm_store_chain_info **, + bool terminate_all_aliasing_chains (imm_store_chain_info **, bool, gimple *); bool terminate_and_release_chain (imm_store_chain_info *); }; // class pass_store_merging @@ -755,8 +755,7 @@ pass_store_merging::terminate_and_process_all_chains () If that is the case we have to terminate any chain anchored at BASE. */ bool -pass_store_merging::terminate_all_aliasing_chains (tree dest, - imm_store_chain_info +pass_store_merging::terminate_all_aliasing_chains (imm_store_chain_info **chain_info, bool var_offset_p, gimple *stmt) @@ -788,7 +787,10 @@ pass_store_merging::terminate_all_aliasing_chains (tree dest, unsigned int i; FOR_EACH_VEC_ELT ((*chain_info)->m_store_info, i, info) { - if (stmt_may_clobber_ref_p (info->stmt, dest)) + if (ref_maybe_used_by_stmt_p (stmt, + gimple_assign_lhs (info->stmt)) + || stmt_may_clobber_ref_p (stmt, + gimple_assign_lhs (info->stmt))) { if (dump_file && (dump_flags & TDF_DETAILS)) { @@ -1458,7 +1460,7 @@ pass_store_merging::execute (function *fun) } /* Store aliases any existing chain? */ - terminate_all_aliasing_chains (lhs, chain_info, false, stmt); + terminate_all_aliasing_chains (chain_info, false, stmt); /* Start a new chain. */ struct imm_store_chain_info *new_chain = new imm_store_chain_info (base_addr); @@ -1477,13 +1479,13 @@ pass_store_merging::execute (function *fun) } } else - terminate_all_aliasing_chains (lhs, chain_info, + terminate_all_aliasing_chains (chain_info, offset != NULL_TREE, stmt); continue; } - terminate_all_aliasing_chains (NULL_TREE, NULL, false, stmt); + terminate_all_aliasing_chains (NULL, false, stmt); } terminate_and_process_all_chains (); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0dff659..242b51b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2016-11-07 Richard Biener <rguenther@suse.de> + PR tree-optimization/78218 + * gcc.dg/torture/pr78218.c: New testcase. + +2016-11-07 Richard Biener <rguenther@suse.de> + PR tree-optimization/78228 * gcc.dg/tree-ssa/phi-opt-15.c: New testcase. diff --git a/gcc/testsuite/gcc.dg/torture/pr78218.c b/gcc/testsuite/gcc.dg/torture/pr78218.c new file mode 100644 index 0000000..b3e2892 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr78218.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ + +struct +{ + int v; +} a[2]; + +int b; + +void __attribute__((noinline,noclone)) +check () +{ + if (a[0].v != 1) + __builtin_abort (); +} + +int main () +{ + a[1].v = 1; + a[0] = a[1]; + a[1].v = 0; + check (a); + return 0; +} |