tree-cfg: Revert code that incorrectly removed case labels
GCC has reverted a change that incorrectly removed case labels, fixing optimizations and a switch statement issue.
A previous commit (r8-546) introduced code to remove case statements that directly lead to __builtin_unreachable. However, this change caused loss of optimization in some cases and resulted in switch statements with only a default case. This commit reverts the problematic part of r8-546, restoring the original behavior and fixing regressions and also addresses PR 125290 by preventing creation of switch statements with only a default case.
In Details
This commit reverts the group_case_labels_stmt part of r8-546-gca4d2851687875 in tree-cfg.cc. The reverted code was intended to remove case statements that jump directly to __builtin_unreachable, but it led to optimization regressions and the creation of switch statements with only a default case. The commit also removes a comment in tree-ssa-forwprop.cc about switch cases being handled, since the handling has been reverted.
For Context
GCC's control flow graph (CFG) represents the flow of execution through a program. The tree-cfg pass manipulates this graph to perform optimizations. __builtin_unreachable is a function that indicates a point in the code that should never be reached. This commit reverts a change that attempted to remove case statements leading to __builtin_unreachable because it caused unintended side effects, including loss of optimizations and the creation of invalid switch statements. Reverting this change restores the compiler's original behavior and resolve related bugs.