]> git.ipfire.org Git - thirdparty/gcc.git/commit
complex: Don't DCE unused COMPLEX_EXPRs for -O0 [PR119190]
authorJakub Jelinek <jakub@redhat.com>
Tue, 11 Mar 2025 09:57:30 +0000 (10:57 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 11 Mar 2025 09:57:30 +0000 (10:57 +0100)
commite1da6283a1cbd5db474c0f7e5cca9b9876768199
tree2670e400f7ffc279e44c6615300b48b02bd2f866
parent3b1bd1fdcd241dd1e5b706b6937400d74ca43146
complex: Don't DCE unused COMPLEX_EXPRs for -O0 [PR119190]

The PR116463 r15-3128 change regressed the following testcase at -O0.
While for -O1+ we can do -fvar-tracking-assignments, for -O0 we don't
(partly because it is compile time expensive and partly because at -O0
most of the vars live most of their lifetime in memory slots), so if we
DCE some statements, it can mean that DW_AT_location for some vars won't
be available or even it won't be possible to put a breakpoint at some
particular line in the source.
We normally perform dce just in the subpasses of
pass_local_optimization_passes or pass_all_optimizations or
pass_all_optimizations_g, so don't do that at all for -O0.  So the complex
change is an exception.  And it was described as a way to help forwprop and
reassoc, neither applies to -O0.

This regresses PR119120 again though, I'll post a patch for that momentarily.

2025-03-11  Jakub Jelinek  <jakub@redhat.com>

PR debug/119190
* tree-complex.cc (update_complex_assignment, tree_lower_complex):
Perform simple dce on dce_worklist only if optimize.

* gfortran.dg/guality/pr119190.f90: New test.
gcc/testsuite/gfortran.dg/guality/pr119190.f90 [new file with mode: 0644]
gcc/tree-complex.cc