Don't mark empty-loop block as empty in the first place

This commit is contained in:
Dmitry Stogov 2023-12-14 17:06:40 +03:00
parent 4569d58072
commit b5c827ce25
2 changed files with 1 additions and 5 deletions

View File

@ -1162,10 +1162,6 @@ uint32_t ir_skip_empty_target_blocks(const ir_ctx *ctx, uint32_t b)
bb = &ctx->cfg_blocks[b];
if ((bb->flags & (IR_BB_START|IR_BB_ENTRY|IR_BB_EMPTY)) == IR_BB_EMPTY) {
if (ctx->cfg_edges[bb->successors] == b) {
/* empty loop */
break;
}
b = ctx->cfg_edges[bb->successors];
} else {
break;

View File

@ -609,7 +609,7 @@ int ir_match(ir_ctx *ctx)
if (insn->op == IR_END || insn->op == IR_LOOP_END) {
ctx->rules[ref] = insn->op;
ref = prev_ref[ref];
if (ref == start) {
if (ref == start && ctx->cfg_edges[bb->successors] != b) {
if (EXPECTED(!(bb->flags & IR_BB_ENTRY))) {
bb->flags |= IR_BB_EMPTY;
} else if (ctx->flags & IR_MERGE_EMPTY_ENTRIES) {