copy_bb_p uses uncond_jump_length in order to gauge when code increase will be negative or neglegible (at -Os) or acceptable (at -O2); however, uncond_jump_length has the wrong value. According to the comment in reorder_basic_blocks, it expects to get a minimal length for an unconditional jump when it calls get_uncond_jump_length in order to set uncond_jump_length. However,it gets a maximal length instead. get_uncond_jump_length returns 5 for i386, and 24 for SH.
-- Summary: basic block reordering excessively increases code size; get_uncond_jump_length pessimistic Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: amylaar at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23898