https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59521
Yuri Gribov <tetra2005 at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41698|0 |1 is obsolete| | --- Comment #8 from Yuri Gribov <tetra2005 at gmail dot com> --- Created attachment 41737 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41737&action=edit New draft patch How about this? I added edge attribute for builtin_expect and later used it in emit_case_decision_tree to emit expected comparison prior to decision tree for other case values. With this patch GCC optimizes original example. If it's not too ugly I'll do proper testing and send to gcc-patches.