https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64215
Jeffrey A. Law <law at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |law at gcc dot gnu.org --- Comment #5 from Jeffrey A. Law <law at gcc dot gnu.org> --- Andrew, the reason the patch you referenced doesn't help this case is because we don't have an unconditional jump to a return only block. To optimize this case we'd have to detect that we have a return only block that is immediately preceded by another return block after bbro. ie: (note 48 23 59 6 [bb 6] NOTE_INSN_BASIC_BLOCK) (insn 59 48 49 6 (use (reg/i:SI 10 a0)) -1 (nil)) (jump_insn 49 59 37 6 (simple_return) 346 {simple_return} (nil) -> simple_return) ;; lr out 1 [ra] 2 [sp] 10 [a0] ;; live out 1 [ra] 2 [sp] 10 [a0] ;; succ: EXIT [always] count:52738306 (estimated locally, freq 0.4591) ;; basic block 7, loop depth 0, count 6317494 (estimated locally, freq 0.0550), maybe hot ;; prev block 6, next block 1, flags: (REACHABLE, RTL) ;; pred: 2 [5.5% (guessed)] count:6317494 (estimated locally, freq 0.0550) (CAN_FALLTHRU) ;; bb 7 artificial_defs: { } ;; bb 7 artificial_uses: { u-1(2){ }} ;; lr in 1 [ra] 2 [sp] 10 [a0] ;; lr use 2 [sp] 10 [a0] ;; lr def ;; live in 1 [ra] 2 [sp] 10 [a0] ;; live gen ;; live kill (code_label 37 49 36 7 4 (nil) [1 uses]) (note 36 37 60 7 [bb 7] NOTE_INSN_BASIC_BLOCK) (insn 60 36 51 7 (use (reg/i:SI 10 a0)) -1 (nil)) (jump_insn 51 60 41 7 (simple_return) 346 {simple_return} (nil) -> simple_return)