This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][PR 59521] Respect probabilities when expanding switch statement
- From: Steven Bosscher <stevenb dot gcc at gmail dot com>
- To: Yuri Gribov <tetra2005 at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, marxin at gcc dot gnu dot org, Jan Hubicka <hubicka at ucw dot cz>
- Date: Thu, 20 Jul 2017 21:41:31 +0200
- Subject: Re: [PATCH][PR 59521] Respect probabilities when expanding switch statement
- Authentication-results: sourceware.org; auth=none
- References: <CAJOtW+5-v6twsrRbLc7qQwkGt6TM8iu-hphznjGDMpWoxG6aLw@mail.gmail.com>
On Tue, Jul 18, 2017 at 9:04 AM, Yuri Gribov wrote:
> Hi all,
>
> Currently all cases in switch statement are treated as having equal
> probabilities which causes suboptimal code as demonstrated in
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59521 . This patch
> modifies expander to select pivot point for decision tree so that
> probabilities of cases on the left are roughly equal to probabilities
> on the right.
>
> Patch survives bootstrap and regtesting on x64 but has some issues:
> * tests are fragile but I'm not sure how to make them better
> * I haven't done any performance measurements - would these be needed?
> I don't have access to SPEC these days, any other suggestions?
>
> Patch is jointly authored with Martin.
Hi Yuri,
Can you come up with test cases that don't scan the assembly output?
Ideally the test case should check a dump file that is as close as
possible to the code transformation, in this case the dump from
pass_expand.
Ciao!
Steven