https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97856
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Version|unknown |11.0 Component|tree-optimization |rtl-optimization Ever confirmed|0 |1 CC| |hubicka at gcc dot gnu.org Status|UNCONFIRMED |NEW Last reconfirmed| |2020-11-17 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. basic-block reordering decides to duplicate the block: Redirecting fallthru edge 7->8 to 9 Duplicated bb 8 (created bb 9) Final order: 2 3 4 8 5 6 7 9 Reordered sequence: 2 bb 2 3 bb 3 4 bb 4 5 bb 8 6 bb 5 7 bb 6 8 bb 7 9 duplicate of 8 since we decide to put the default: handling on the fallthru edge of the condition chain we duplicate it to the tail as well. IIRC expansion always does it this way and BB reorder simply avoids one jump. With -Os we flip the last jump and avoid the duplication.