File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
Misc/NEWS.d/next/Core and Builtins Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change
1
+ Fixed bug where the compiler's ``eliminate_empty_basic_blocks `` function
2
+ ignores the last block of the code unit.
Original file line number Diff line number Diff line change @@ -9349,17 +9349,13 @@ eliminate_empty_basic_blocks(basicblock *entryblock) {
9349
9349
/* Eliminate empty blocks */
9350
9350
for (basicblock * b = entryblock ; b != NULL ; b = b -> b_next ) {
9351
9351
basicblock * next = b -> b_next ;
9352
- if (next ) {
9353
- while (next -> b_iused == 0 && next -> b_next ) {
9354
- next = next -> b_next ;
9355
- }
9356
- b -> b_next = next ;
9352
+ while (next && next -> b_iused == 0 ) {
9353
+ next = next -> b_next ;
9357
9354
}
9355
+ b -> b_next = next ;
9358
9356
}
9359
9357
for (basicblock * b = entryblock ; b != NULL ; b = b -> b_next ) {
9360
- if (b -> b_iused == 0 ) {
9361
- continue ;
9362
- }
9358
+ assert (b -> b_iused > 0 );
9363
9359
for (int i = 0 ; i < b -> b_iused ; i ++ ) {
9364
9360
struct instr * instr = & b -> b_instr [i ];
9365
9361
if (HAS_TARGET (instr -> i_opcode )) {
@@ -9368,6 +9364,7 @@ eliminate_empty_basic_blocks(basicblock *entryblock) {
9368
9364
target = target -> b_next ;
9369
9365
}
9370
9366
instr -> i_target = target ;
9367
+ assert (instr -> i_target && instr -> i_target -> b_iused > 0 );
9371
9368
}
9372
9369
}
9373
9370
}
You can’t perform that action at this time.
0 commit comments