From 47ddea00ac58132bf3da9a800ddf4835b1084537 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 11 Nov 2022 02:56:16 +0300 Subject: [PATCH] Use better conditions --- ir_cfg.c | 5 ++--- ir_private.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ir_cfg.c b/ir_cfg.c index 0d27e55..2528117 100644 --- a/ir_cfg.c +++ b/ir_cfg.c @@ -248,7 +248,6 @@ next_successor: } else { bb->flags = IR_BB_UNREACHABLE; /* all blocks are marked as UNREACHABLE first */ if (insn->op == IR_MERGE || insn->op == IR_LOOP_BEGIN) { - bb->flags |= IR_BB_MERGE; n = ir_variable_inputs_count(insn); bb->predecessors_count = n; edges_count += n; @@ -270,7 +269,7 @@ next_successor: bb = blocks + 1; for (b = 1; b <= bb_count; b++, bb++) { insn = &ctx->ir_base[bb->start]; - if (bb->flags & IR_BB_MERGE) { + if (bb->predecessors_count > 1) { uint32_t *q = edges + bb->predecessors; n = ir_variable_inputs_count(insn); for (p = insn->ops + 1; n > 0; p++, q++, n--) { @@ -281,7 +280,7 @@ next_successor: *q = pred_b; edges[pred_bb->successors + pred_bb->successors_count++] = b; } - } else if (!(bb->flags & (IR_BB_START|IR_BB_ENTRY))) { + } else if (bb->predecessors_count == 1) { ref = insn->op1; IR_ASSERT(ref); IR_ASSERT(IR_OPND_KIND(ir_op_flags[insn->op], 1) == IR_OPND_CONTROL); diff --git a/ir_private.h b/ir_private.h index 5d08bd2..332e5ca 100644 --- a/ir_private.h +++ b/ir_private.h @@ -777,7 +777,6 @@ struct _ir_use_list { #define IR_BB_IRREDUCIBLE_LOOP (1<<4) #define IR_BB_DESSA_MOVES (1<<5) /* translation out of SSA requires MOVEs */ #define IR_BB_EMPTY (1<<6) -#define IR_BB_MERGE (1<<7) /* IR_MERGE ir IR_LOOP_BEGIN */ struct _ir_block { uint32_t flags;