diff --git a/ir_cfg.c b/ir_cfg.c index ce33f97..f22d9f0 100644 --- a/ir_cfg.c +++ b/ir_cfg.c @@ -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; diff --git a/ir_emit.c b/ir_emit.c index f89a747..7e10440 100644 --- a/ir_emit.c +++ b/ir_emit.c @@ -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) {