[Bug middle-end/61912] Missed (partial) dead store elimination for structures on GIMPLE

2017-01-16 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61912

--- Comment #9 from Jeffrey A. Law  ---
Author: law
Date: Mon Jan 16 23:43:05 2017
New Revision: 244509

URL: https://gcc.gnu.org/viewcvs?rev=244509=gcc=rev
Log:
2017-01-16  Jeff Law  

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.

Added:
trunk/gcc/testsuite/g++.dg/tree-ssa/ssa-dse-2.C
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-dse.c

[Bug middle-end/61912] Missed (partial) dead store elimination for structures on GIMPLE

2017-01-13 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61912

--- Comment #8 from Jeffrey A. Law  ---
Author: law
Date: Sat Jan 14 06:16:23 2017
New Revision: 244461

URL: https://gcc.gnu.org/viewcvs?rev=244461=gcc=rev
Log:
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.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/tree-ssa-dse.c

[Bug middle-end/61912] Missed (partial) dead store elimination for structures on GIMPLE

2017-01-13 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61912

Jeffrey A. Law  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Jeffrey A. Law  ---
Fixed on the trunk.

[Bug middle-end/61912] Missed (partial) dead store elimination for structures on GIMPLE

2017-01-13 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61912

--- Comment #6 from Jeffrey A. Law  ---
Author: law
Date: Fri Jan 13 15:46:22 2017
New Revision: 23

URL: https://gcc.gnu.org/viewcvs?rev=23=gcc=rev
Log:
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.

Added:
trunk/gcc/testsuite/g++.dg/tree-ssa/ssa-dse-1.C
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-24.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr30375.c
trunk/gcc/tree-ssa-dse.c

[Bug middle-end/61912] Missed (partial) dead store elimination for structures on GIMPLE

2017-01-13 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61912

--- Comment #5 from Jeffrey A. Law  ---
Author: law
Date: Fri Jan 13 15:42:08 2017
New Revision: 22

URL: https://gcc.gnu.org/viewcvs?rev=22=gcc=rev
Log:
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.

Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-18.c
  - copied, changed from r21,
trunk/gcc/testsuite/gcc.dg/tree-ssa/complex-4.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-19.c
  - copied, changed from r21,
trunk/gcc/testsuite/gcc.dg/tree-ssa/complex-4.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-20.c
  - copied, changed from r21,
trunk/gcc/testsuite/gcc.dg/tree-ssa/complex-5.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-21.c
  - copied, changed from r21,
trunk/gcc/testsuite/gcc.dg/tree-ssa/complex-5.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/doc/invoke.texi
trunk/gcc/params.def
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/tree-ssa/complex-4.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/complex-5.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-9.c
trunk/gcc/tree-ssa-dse.c

[Bug middle-end/61912] Missed (partial) dead store elimination for structures on GIMPLE

2017-01-13 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61912

--- Comment #4 from Jeffrey A. Law  ---
Author: law
Date: Fri Jan 13 15:37:09 2017
New Revision: 21

URL: https://gcc.gnu.org/viewcvs?rev=21=gcc=rev
Log:
PR tree-optimization/33562
PR tree-optimization/61912
PR tree-optimization/77485
* sbitmap.h (bitmap_count_bits): Prototype.
(bitmap_clear_range, bitmap_set_range): Likewise.
* sbitmap.c (bitmap_clear_range): New function.
(bitmap_set_range, sbitmap_popcount, bitmap_count_bits): Likewise.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/sbitmap.c
trunk/gcc/sbitmap.h

[Bug middle-end/61912] Missed (partial) dead store elimination for structures on GIMPLE

2016-12-15 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61912

Jeffrey A. Law  changed:

   What|Removed |Added

 CC||petschy at gmail dot com

--- Comment #3 from Jeffrey A. Law  ---
*** Bug 77485 has been marked as a duplicate of this bug. ***

[Bug middle-end/61912] Missed (partial) dead store elimination for structures on GIMPLE

2016-12-15 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61912

Jeffrey A. Law  changed:

   What|Removed |Added

 CC||law at redhat dot com

--- Comment #2 from Jeffrey A. Law  ---
So testing this with my improvements to DSE, we discover that the first 12
bytes and the last 4 bytes of the CONSTRUCTOR assignment are dead.  Leaving
just 4 bytes to be handled by the CONSTRUCTOR assignment.Prior to DSE this
looked like:

  info = {};
  info.prec = prec_11(D);
 [ ... more explicit assignments ... ]

With the DSE improvements it turns into;


  MEM[(char[4] *) + 12B] = {};
  info.prec = prec_11(D);
[ more explicit assignment follow. ]

Note how we turned the full CONSTRUCTOR into one that starts at byte offset 12
and just writes 4 bytes.

We could have started the CONSTRUCTOR at byte 13 instead of byte 12, as the
first 8 single bit fields are assigned explicitly.  The code detects this
properly, but explicitly avoids trimming to an odd start byte so as not to
totally muck up alignments.

[Bug middle-end/61912] Missed (partial) dead store elimination for structures on GIMPLE

2014-07-28 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61912

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||missed-optimization
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2014-07-28
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener rguenth at gcc dot gnu.org ---
Note that there is a heuristic on whether emitting a clear is profitable
already
during lowering of the init in gimplify_init_constructor.  It doesn't apply a
very simple optimization - start zeroing only after the leading block of
fully-initialized vars (and only up-to the last block of fully-initialized
vars).

GIMPLE DSE cannot eliminate the store because it isn't dead - it would need to
split it up for that, something which it doesn't implement.

I think adjusting the heuristic for the initial code-generation is more
appropriate here.