If any unconditional jumps within a block have side effects then the block cannot be considered empty.
gcc/ * cfgrtl.c (rtl_block_empty_p): Return false if `!onlyjump_p' too. --- gcc/cfgrtl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) gcc-cfgrtl-block-empty-only-jump.diff Index: gcc/gcc/cfgrtl.c =================================================================== --- gcc.orig/gcc/cfgrtl.c +++ gcc/gcc/cfgrtl.c @@ -4860,7 +4860,8 @@ rtl_block_empty_p (basic_block bb) return true; FOR_BB_INSNS (bb, insn) - if (NONDEBUG_INSN_P (insn) && !any_uncondjump_p (insn)) + if (NONDEBUG_INSN_P (insn) + && (!any_uncondjump_p (insn) || !onlyjump_p (insn))) return false; return true;