Use better conditions

This commit is contained in:
Dmitry Stogov 2022-11-11 02:56:16 +03:00
parent a4b09dd3ce
commit 47ddea00ac
2 changed files with 2 additions and 4 deletions

View File

@ -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);

View File

@ -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;