------- Comment #3 from jakub at gcc dot gnu dot org 2010-06-09 13:55 ------- There are more issues: 1) cleanup_barriers seems to do weird things with these empty bbs from __builtin_unreachable (), I guess it shouldn't reorder anything if prev is a LABEL_P 2) the reason why this compiles fine on x86_64 seems to be in different bb reordering. On arm the empty bb is reordered after the condjump, which means its label is deleted by /* Remove code labels no longer used. */ in try_optimize_cfg and then the block is trivially empty. On x86_64 we don't ICE, but generate useless code: movl (%rdi), %eax testl %eax, %eax je .L2 cmpl $1, %eax jne .L3 movq %rdi, %rsi .L2: xorl %eax, %eax cmpb $0, (%rsi) sete %al ret .L3: .cfi_endproc
I'd say we shouldn't try to delete just trivially_empty_bb_p's, but also ones that before the bb note also have labels and after it nothing or only DEBUG_INSNs, but we should delete only if we actually succeed adjusting the jump insn at the end of the earlier block. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44469