@@ -7364,7 +7364,7 @@ mark_cold(basicblock *entryblock) {
7364
7364
for (int i = 0 ; i < b -> b_iused ; i ++ ) {
7365
7365
struct instr * instr = & b -> b_instr [i ];
7366
7366
if (is_jump (instr )) {
7367
- assert (i == b -> b_iused - 1 );
7367
+ assert (i == b -> b_iused - 1 );
7368
7368
basicblock * target = b -> b_instr [i ].i_target ;
7369
7369
if (!target -> b_warm && !target -> b_visited ) {
7370
7370
* sp ++ = target ;
@@ -8322,7 +8322,7 @@ insert_instruction(basicblock *block, int pos, struct instr *instr) {
8322
8322
if (basicblock_next_instr (block ) < 0 ) {
8323
8323
return -1 ;
8324
8324
}
8325
- for (int i = block -> b_iused - 1 ; i > pos ; i -- ) {
8325
+ for (int i = block -> b_iused - 1 ; i > pos ; i -- ) {
8326
8326
block -> b_instr [i ] = block -> b_instr [i - 1 ];
8327
8327
}
8328
8328
block -> b_instr [pos ] = * instr ;
@@ -8520,21 +8520,19 @@ remove_redundant_jumps(cfg_builder *g) {
8520
8520
* of that jump. If it is, then the jump instruction is redundant and
8521
8521
* can be deleted.
8522
8522
*/
8523
- int removed = 0 ;
8523
+ assert ( no_empty_basic_blocks ( g )) ;
8524
8524
for (basicblock * b = g -> g_entryblock ; b != NULL ; b = b -> b_next ) {
8525
8525
struct instr * last = basicblock_last_instr (b );
8526
- if (last != NULL ) {
8527
- assert (!IS_ASSEMBLER_OPCODE (last -> i_opcode ));
8528
- if (IS_UNCONDITIONAL_JUMP_OPCODE (last -> i_opcode )) {
8529
- if (last -> i_target == NULL ) {
8530
- PyErr_SetString (PyExc_SystemError , "jump with NULL target" );
8531
- return -1 ;
8532
- }
8533
- if (last -> i_target == b -> b_next ) {
8534
- assert (b -> b_next -> b_iused );
8535
- last -> i_opcode = NOP ;
8536
- removed ++ ;
8537
- }
8526
+ assert (last != NULL );
8527
+ assert (!IS_ASSEMBLER_OPCODE (last -> i_opcode ));
8528
+ if (IS_UNCONDITIONAL_JUMP_OPCODE (last -> i_opcode )) {
8529
+ if (last -> i_target == NULL ) {
8530
+ PyErr_SetString (PyExc_SystemError , "jump with NULL target" );
8531
+ return -1 ;
8532
+ }
8533
+ if (last -> i_target == b -> b_next ) {
8534
+ assert (b -> b_next -> b_iused );
8535
+ last -> i_opcode = NOP ;
8538
8536
}
8539
8537
}
8540
8538
}
@@ -9317,7 +9315,7 @@ check_cfg(cfg_builder *g) {
9317
9315
int opcode = b -> b_instr [i ].i_opcode ;
9318
9316
assert (!IS_ASSEMBLER_OPCODE (opcode ));
9319
9317
if (IS_TERMINATOR_OPCODE (opcode )) {
9320
- if (i != b -> b_iused - 1 ) {
9318
+ if (i != b -> b_iused - 1 ) {
9321
9319
PyErr_SetString (PyExc_SystemError , "malformed control flow graph." );
9322
9320
return -1 ;
9323
9321
}
0 commit comments