Properly save UNREACHABLE instruction eith third operand

This commit is contained in:
Dmitry Stogov 2023-11-14 17:12:20 +03:00
parent a2c6f98e75
commit fab41058d4
2 changed files with 4 additions and 2 deletions

View File

@ -577,7 +577,8 @@ void ir_dump_codegen(const ir_ctx *ctx, FILE *f)
} else if (opnd_kind == IR_OPND_NUM) {
fprintf(f, "%s%d", first ? "(" : ", ", ref);
first = 0;
} else if (IR_IS_REF_OPND_KIND(opnd_kind) && j != n) {
} else if (j != n &&
(IR_IS_REF_OPND_KIND(opnd_kind) || (opnd_kind == IR_OPND_UNUSED && p[n-j]))) {
fprintf(f, "%snull", first ? "(" : ", ");
first = 0;
}

View File

@ -102,7 +102,8 @@ void ir_save(const ir_ctx *ctx, FILE *f)
} else if (opnd_kind == IR_OPND_NUM) {
fprintf(f, "%s%d", first ? "(" : ", ", ref);
first = 0;
} else if (IR_IS_REF_OPND_KIND(opnd_kind) && j != n) {
} else if (j != n &&
(IR_IS_REF_OPND_KIND(opnd_kind) || (opnd_kind == IR_OPND_UNUSED && p[n-j]))) {
fprintf(f, "%snull", first ? "(" : ", ");
first = 0;
}