This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PING] genattrab.c generate switch


On 03/04/2016 08:13 AM, Bernd Schmidt wrote:
On 03/04/2016 03:27 PM, Patrick Palka wrote:
I still suggest to try making write_test_expr() avoid emitting
redundant parentheses for chains of || or &&, which would fix the
original issue all the same.  Previously you claimed that such a
change would not be simpler than your current patch, but I gave it a
quick try and ended up with a much smaller patch:

This looks like a reasonable stopgap if a release manager thinks this is
important enough to fix for gcc-6. Some comments below for that case.
Longer term I'm not sure - in theory maybe the switch would allow us to
generate better code, but I tried it and code size actually seems to go
up (could be jump tables however). I also noticed that in the version
with the switch we still have cases of

switch (cached_type)
{
  ....
  default:
    switch (cached_type)
    {
    }
}

so that might be a point where the patch could be improved to see if we
can get better code generation by collapsing these switches. Might also
be worth trying to optimize this pattern in gcc.
There's probably a good number of things we could do for this and related scenarios. Essentially DOM and threading are unlikely to do anything with this because the path from the outer case into the inner switch is going to have multiple values associated with cached_type.

The backwards threader, if it was presented with SSI rather than SSA could probably untangle it, but I'm not sure we're ready to make the jump to SSI (though it would simplify VRP & DOM).

Jeff



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]