Skip op1 of CONTROL nodes

This commit is contained in:
Dmitry Stogov 2022-09-05 22:00:00 +03:00
parent e0e5838a4b
commit d5f73bf388

View File

@ -567,7 +567,9 @@ int ir_sccp(ir_ctx *ctx)
flags = ir_op_flags[insn->op]; flags = ir_op_flags[insn->op];
n = ir_input_edges_count(ctx, insn); n = ir_input_edges_count(ctx, insn);
for (j = 1; j <= n; j++) { /* first input is source control (we may skip it) */
IR_ASSERT(n == 0 || IR_OPND_KIND(flags, 1) == IR_OPND_CONTROL);
for (j = 2; j <= n; j++) {
if (IR_OPND_KIND(flags, j) == IR_OPND_DATA || IR_OPND_KIND(flags, j) == IR_OPND_VAR) { if (IR_OPND_KIND(flags, j) == IR_OPND_DATA || IR_OPND_KIND(flags, j) == IR_OPND_VAR) {
use = insn->ops[j]; use = insn->ops[j];
if (use > 0 && IR_IS_TOP(use) && !ir_bitqueue_in(&worklist, use)) { if (use > 0 && IR_IS_TOP(use) && !ir_bitqueue_in(&worklist, use)) {