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 04/03/16 16:13, 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.



Bernd
I can look into that if you deem it worth it, or would you rather just go with Patriks suppressed parenthesis?


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