Fix IR checker

This commit is contained in:
Dmitry Stogov 2022-09-13 12:44:59 +03:00
parent bab62d42c9
commit 5aad53388d

View File

@ -137,7 +137,7 @@ bool ir_check(ir_ctx *ctx)
}
case IR_OPND_CONTROL_DEP:
if (use >= i
&& !(insn->op == IR_LOOP_BEGIN && j > 1)) {
&& !(insn->op == IR_LOOP_BEGIN)) {
fprintf(stderr, "ir_base[%d].ops[%d] invalid forward reference (%d)\n", i, j, use);
ok = 0;
}
@ -166,7 +166,7 @@ bool ir_check(ir_ctx *ctx)
/* pass (function returns void) */
} else if (insn->op == IR_BEGIN && j == 1) {
/* pass (start of unreachable basic block) */
} else if (insn->op == IR_LOOP_BEGIN && j > 1) {
} else if (insn->op == IR_LOOP_BEGIN || insn->op == IR_MERGE) {
/* TODO: something wrong ??? */
} else if (IR_OPND_KIND(flags, j) != IR_OPND_CONTROL_REF) {
fprintf(stderr, "ir_base[%d].ops[%d] missing reference (%d)\n", i, j, use);