From 59b63cbb9174224e8934aabd889cab4e7ec35ac3 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 27 Apr 2022 21:24:51 +0300 Subject: [PATCH] Sort oputput UsePos after inputs --- ir_ra.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ir_ra.c b/ir_ra.c index 58b7e86..f06dbfe 100644 --- a/ir_ra.c +++ b/ir_ra.c @@ -194,7 +194,9 @@ static void ir_add_use_pos(ir_ctx *ctx, int v, ir_use_pos *use_pos) ir_use_pos *prev = NULL; ir_use_pos *p = ival->use_pos; - while (p && (p->pos < use_pos->pos || (p->pos == use_pos->pos && p->op_num < use_pos->op_num))) { + while (p && (p->pos < use_pos->pos || + (p->pos == use_pos->pos && + (use_pos->op_num == 0 || p->op_num < use_pos->op_num)))) { prev = p; p = p->next; }