Sort oputput UsePos after inputs

This commit is contained in:
Dmitry Stogov 2022-04-27 21:24:51 +03:00
parent 7f8f186abd
commit 59b63cbb91

View File

@ -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;
}