From fab41058d41c7ec78acf2b674464c16bbc2dc94e Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 14 Nov 2023 17:12:20 +0300 Subject: [PATCH] Properly save UNREACHABLE instruction eith third operand --- ir_dump.c | 3 ++- ir_save.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ir_dump.c b/ir_dump.c index 06c1bf6..cfd8b81 100644 --- a/ir_dump.c +++ b/ir_dump.c @@ -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; } diff --git a/ir_save.c b/ir_save.c index d89ec6e..68d8aba 100644 --- a/ir_save.c +++ b/ir_save.c @@ -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; }