[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] tcg: fix dead computation for repeated input argume

From: Aurelien Jarno
Subject: [Qemu-devel] [PATCH] tcg: fix dead computation for repeated input arguments
Date: Tue, 19 May 2015 12:26:48 +0200

When the same temp is used twice or more as an input argument to a TCG
instruction, the dead computation code doesn't recognize the second use
as a dead temp. This is because the temp is marked as live in the same
loop where dead inputs are checked.

The fix is to split the loop in two parts. This avoid emitting a move
and using a register for the movcond instruction when used as "move if
true" on x86-64. This might bring more improvements on RISC TCG targets
which don't have outputs aliased to inputs.

Cc: Richard Henderson <address@hidden>
Signed-off-by: Aurelien Jarno <address@hidden>
 tcg/tcg.c | 3 +++
 1 file changed, 3 insertions(+)

NB: The dead computation loop for call has the same problem, but it will
not improve the generated code as anyway the value has to be copied to
a register or memory. I am therefore not sure it is worth fixing it as
it might bring some performance penalty.

diff --git a/tcg/tcg.c b/tcg/tcg.c
index f1558b7..58ca693 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1522,6 +1522,9 @@ static void tcg_liveness_analysis(TCGContext *s)
                     if (dead_temps[arg]) {
                         dead_args |= (1 << i);
+                }
+                for (i = nb_oargs; i < nb_oargs + nb_iargs; i++) {
+                    arg = args[i];
                     dead_temps[arg] = 0;
                 s->op_dead_args[oi] = dead_args;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]