[PATCH][PR 59521] Respect probabilities when expanding switch statement

Yuri Gribov tetra2005@gmail.com
Tue Jul 18 07:04:00 GMT 2017


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.

-Y
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr59521-1.patch
Type: application/octet-stream
Size: 14972 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170718/1bfb84e8/attachment.obj>


More information about the Gcc-patches mailing list