From 2c2f2dababf14c74c8193031be7ce03db09e9d3a Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 15 Apr 2022 00:35:02 +0300 Subject: [PATCH] Better use placement --- ir_ra.c | 2 +- tests/x86_64/ra_009.irt | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ir_ra.c b/ir_ra.c index 95ca2b5..e80775a 100644 --- a/ir_ra.c +++ b/ir_ra.c @@ -329,7 +329,7 @@ int ir_compute_live_ranges(ir_ctx *ctx) } else { reg = ctx->rules ? ir_uses_fixed_reg(ctx, i, j) : IR_REG_NONE; if (reg != IR_REG_NONE) { - use_pos = IR_GAP_LIVE_POS_FROM_REF(i); + use_pos = IR_START_LIVE_POS_FROM_REF(i); // TODO: ??? ir_add_fixed_live_range(ctx, reg, IR_USE_LIVE_POS_FROM_REF(i), IR_DEF_LIVE_POS_FROM_REF(i)); } else { diff --git a/tests/x86_64/ra_009.irt b/tests/x86_64/ra_009.irt index 945d4c2..c3bd2f4 100644 --- a/tests/x86_64/ra_009.irt +++ b/tests/x86_64/ra_009.irt @@ -13,3 +13,13 @@ l_4 = RETURN(l_1, x_3); } --EXPECT-- +test: + movl %edx, %ecx + movl %edi, %eax + xorl %edx, %edx + divl %esi + movl %edx, %eax + xorl %edx, %edx + divl %ecx + movl %edx, %eax + retq