[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 3/9] tcg: fix register allocation with two aliased de
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PULL 3/9] tcg: fix register allocation with two aliased dead inputs |
Date: |
Tue, 9 Jun 2015 07:12:59 -0700 |
From: Aurelien Jarno <address@hidden>
For TCG ops with two outputs registers (add2, sub2, div2, div2u), when
the same input temp is used for the two inputs aliased to the two
outputs, and when these inputs are both dead, the register allocation
code wrongly assigned the same register to the same output.
This happens for example with sub2 t1, t2, t3, t3, t4, t5, when t3 is
not used anymore after the TCG op. In that case the same register is
used for t1, t2 and t3.
The fix is to look for already allocated aliased input when allocating
a dead aliased input and check that the register is not already
used.
Cc: Richard Henderson <address@hidden>
Signed-off-by: Aurelien Jarno <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/tcg.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 427b66b..4a6eb26 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -2007,6 +2007,16 @@ static void tcg_reg_alloc_op(TCGContext *s,
if (!IS_DEAD_ARG(i)) {
goto allocate_in_reg;
}
+ /* check if the current register has already been allocated
+ for another input aliased to an output */
+ int k2, i2;
+ for (k2 = 0 ; k2 < k ; k2++) {
+ i2 = def->sorted_args[nb_oargs + k2];
+ if ((def->args_ct[i2].ct & TCG_CT_IALIAS) &&
+ (new_args[i2] == ts->reg)) {
+ goto allocate_in_reg;
+ }
+ }
}
}
reg = ts->reg;
--
2.4.2
- [Qemu-devel] [PULL 0/9] tcg patch queue, Richard Henderson, 2015/06/09
- [Qemu-devel] [PULL 1/9] tcg: Mask TCGMemOp appropriately for indexing, Richard Henderson, 2015/06/09
- [Qemu-devel] [PULL 2/9] tcg: Handle MO_AMASK in tcg_dump_ops, Richard Henderson, 2015/06/09
- [Qemu-devel] [PULL 3/9] tcg: fix register allocation with two aliased dead inputs,
Richard Henderson <=
- [Qemu-devel] [PULL 4/9] tcg: fix dead computation for repeated input arguments, Richard Henderson, 2015/06/09
- [Qemu-devel] [PULL 5/9] tcg/optimize: remove opc argument from tcg_opt_gen_movi, Richard Henderson, 2015/06/09
- [Qemu-devel] [PULL 7/9] tcg/optimize: fold temp copies test in tcg_opt_gen_mov, Richard Henderson, 2015/06/09
- [Qemu-devel] [PULL 6/9] tcg/optimize: remove opc argument from tcg_opt_gen_mov, Richard Henderson, 2015/06/09
- [Qemu-devel] [PULL 9/9] tcg/optimize: rename tcg_constant_folding, Richard Henderson, 2015/06/09
- [Qemu-devel] [PULL 8/9] tcg/optimize: fold constant test in tcg_opt_gen_mov, Richard Henderson, 2015/06/09
- Re: [Qemu-devel] [PULL 0/9] tcg patch queue, Peter Maydell, 2015/06/09