Skip to content

Commit

Permalink
Set IR_BB_LOOP_WITH_ENTRY flag for all enclosing loops containig ENTR…
Browse files Browse the repository at this point in the history
…Y instruction.

Previoudly we set IR_BB_LOOP_WITH_ENTRY only for the deepest loop.
  • Loading branch information
dstogov committed Sep 18, 2024
1 parent 4f02f1b commit 84a4b42
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ir_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,20 @@ int ir_find_loops(ir_ctx *ctx)
bb->loop_depth = loop_depth;
if (bb->flags & (IR_BB_ENTRY|IR_BB_LOOP_WITH_ENTRY)) {
loop->flags |= IR_BB_LOOP_WITH_ENTRY;
if (loop_depth > 1) {
/* Set IR_BB_LOOP_WITH_ENTRY flag for all the enclosing loops */
bb = &blocks[loop->loop_header];
while (1) {
if (bb->flags & IR_BB_LOOP_WITH_ENTRY) {
break;
}
bb->flags |= IR_BB_LOOP_WITH_ENTRY;
if (bb->loop_depth == 1) {
break;
}
bb = &blocks[loop->loop_header];
}
}
}
}
}
Expand Down

0 comments on commit 84a4b42

Please sign in to comment.