@@ -522,14 +522,15 @@ no_redundant_jumps(cfg_builder *g) {
522522static int
523523normalize_jumps_in_block (cfg_builder * g , basicblock * b ) {
524524 cfg_instr * last = basicblock_last_instr (b );
525- if (last == NULL || !is_jump (last ) ||
526- IS_UNCONDITIONAL_JUMP_OPCODE (last -> i_opcode )) {
525+ if (last == NULL || !IS_CONDITIONAL_JUMP_OPCODE (last -> i_opcode )) {
527526 return SUCCESS ;
528527 }
529528 assert (!IS_ASSEMBLER_OPCODE (last -> i_opcode ));
530529
531530 bool is_forward = last -> i_target -> b_visited == 0 ;
532531 if (is_forward ) {
532+ RETURN_IF_ERROR (
533+ basicblock_addop (b , NOT_TAKEN , 0 , NO_LOCATION ));
533534 return SUCCESS ;
534535 }
535536
@@ -557,12 +558,8 @@ normalize_jumps_in_block(cfg_builder *g, basicblock *b) {
557558 if (backwards_jump == NULL ) {
558559 return ERROR ;
559560 }
560- assert (b -> b_next -> b_iused > 0 );
561- assert (b -> b_next -> b_instr [0 ].i_opcode == NOT_TAKEN );
562- b -> b_next -> b_instr [0 ].i_opcode = NOP ;
563- b -> b_next -> b_instr [0 ].i_loc = NO_LOCATION ;
564561 RETURN_IF_ERROR (
565- basicblock_addop (backwards_jump , NOT_TAKEN , 0 , last -> i_loc ));
562+ basicblock_addop (backwards_jump , NOT_TAKEN , 0 , NO_LOCATION ));
566563 RETURN_IF_ERROR (
567564 basicblock_add_jump (backwards_jump , JUMP , target , last -> i_loc ));
568565 last -> i_opcode = reversed_opcode ;
0 commit comments