Keep any jump that has side effects as those must not be removed. gcc/ * loop-doloop.c (add_test): Only remove the jump if `onlyjump_p'. --- gcc/loop-doloop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
gcc-loop-doloop-add-test-only-jump.diff Index: gcc/gcc/loop-doloop.c =================================================================== --- gcc.orig/gcc/loop-doloop.c +++ gcc/gcc/loop-doloop.c @@ -378,7 +378,7 @@ add_test (rtx cond, edge *e, basic_block bb = split_edge_and_insert (*e, seq); *e = single_succ_edge (bb); - if (any_uncondjump_p (jump)) + if (any_uncondjump_p (jump) && onlyjump_p (jump)) { /* The condition is always true. */ delete_insn (jump);