This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/59521] __builtin_expect not effective in switch
- From: "tetra2005 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 17 Jul 2017 07:43:26 +0000
- Subject: [Bug middle-end/59521] __builtin_expect not effective in switch
- Auto-submitted: auto-generated
- References: <bug-59521-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59521
Yuri Gribov <tetra2005 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #41737|0 |1
is obsolete| |
--- Comment #13 from Yuri Gribov <tetra2005 at gmail dot com> ---
Created attachment 41770
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41770&action=edit
Yet another patch
Ok, this one works both for __builtin_expect and -fprofile-generate and
survives bootstrap on x64. I've modified switch decision tree creation to
select pivot value based on probabilities rather than number of values on left
and right (somewhat similar to ID3 algorithm for decision trees).
If patch looks fine in general, I'll add tests and submit for review.