http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51513
Emil L <empann at hotmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |empann at hotmail dot com
--- Comment #3 from Emil L <empann at hotmail dot com> 2012-12-11 21:54:01 UTC
---
The optimization can either be done when emitting rtl in the expand_case
function in stmt.c (and its callees) by first recognizing calls to
__builtin_unreachable() at the default label, and then simply do not emit the
compares and jumps to the default label. That task is quite easy.
Another option would be to add more general code in the later cfg optimization
passes for rtl that removes all jumps (and corresponding compares) to basic
blocks only containing barriers.
What do you think?
This optimization would be very interesting for interpreter implementators that
use a switch statement to dispatch the next instruction, when they can
guarantee that the default branch is never taken.