This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] [P2] [PR tree-optimization/33562] Lowering more complex assignments.
- From: Jeff Law <law at redhat dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 18 Feb 2016 15:41:03 -0700
- Subject: Re: [RFC] [P2] [PR tree-optimization/33562] Lowering more complex assignments.
- Authentication-results: sourceware.org; auth=none
- References: <56BD1EFB dot 90008 at redhat dot com> <CAFiYyc3iYgzrprV2V=C02nbAmZntPy7QH_=Dxo_UXps7sneh_g at mail dot gmail dot com> <56BE14B0 dot 9040801 at redhat dot com> <56C0ACC1 dot 60905 at redhat dot com> <0D3F08EF-9DC3-4848-AEC7-1AE639464B3D at gmail dot com> <56C4217F dot 2040809 at redhat dot com> <CAFiYyc0D4-Fum24QD9TYsC6DvPd71yuWnhKZeuEk-BpjcONQkQ at mail dot gmail dot com> <56C47D5C dot 7010804 at redhat dot com> <CAFiYyc0Jx1xgRsr0NK5OS+iYZ9dzCm4ea3UmLQAAHA61PyaeuA at mail dot gmail dot com> <56C49B69 dot 2090209 at redhat dot com> <CAFiYyc3YHBhRhY2yscp6Fwx7t0f04jg8e5sbTCyjxOFKxd2H+Q at mail dot gmail dot com>
On 02/18/2016 02:56 AM, Richard Biener wrote:
Right. But handling that has never been part of DSE's design goals. Once
there's a use, DSE has always given up.
Yeah, which is why I in the end said we need a "better" DSE ...
Well, I don't see a rewrite/redesign in the mid-term horizon.
Having said that...
That is, you don't make use of the live_bytes in the
ref_maybe_used_by_stmt_p
check (you can skip uses of only dead bytes).
Not sure if it makes a difference in practice (compared to the cost it
would take).
Not sure either. It doesn't appear that it would be hard to experiment with
that to see if it's worth the effort. My gut feeling is we're not going to
see this often, if at all, in practice.
Yeah, I think the case we're after and that happens most is sth like
a = { aggregate init };
a.a = ...;
a.b = ...;
...
and what you add is the ability to remove the aggregate init completely.
Essentially, yes.
What would be nice to have is to remove it partly as well, as for
struct { int i; int j; int k; } a = {};
a.i = 1;
a.k = 3;
we'd like to remove the whole-a zeroing but we need to keep zeroing
of a.j.
I believe that SRA already has most of the analysis part, what it is
lacking is that SRA works not flow-sensitive (it just gathers
function-wide data) and that it doesn't consider base objects that
have their address taken or are pointer-based.
I guess we could look at the live bytes at the end of the loop in
dse_possible_dead_store_p and perhaps re-write the original statement.
That said, your patch addresses a very specific case nothing else in
the compiler
handles right now, but it's also quite limited. So evaluating the compile-time
impact is important here as well as trying to cover more cases of "partial inits
after full inits" optimization.
It's fairly narrow. Most of the stuff it's finding are just the
clobbers and removing those is totally uninteresting from a code
generation standpoint.
I'm going to do another round of statistics gathering, filtering out all
the clobbers. Some light poking would indicate there's still real world
codes where this will help (in libstdc++, not surprisingly), but it's
not going to be as broad as I'd like.
I don't believe we need to rush this into GCC 6.
Not looking to rush this -- it seems simple enough and fixes a long
standing regression. I think it's appropriate, but I'm not going to get
bent out of shape if you disagree and we table it until GCC 7.
jeff