qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] 64-on-32 TCG broken


From: Kirill Batuzov
Subject: Re: [Qemu-devel] 64-on-32 TCG broken
Date: Wed, 7 Nov 2012 17:26:58 +0400 (MSK)
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)

> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index c3a7f19..1133438 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -1329,8 +1329,8 @@ static void tcg_liveness_analysis(TCGContext *s)
>                 the low part.  The result can be optimized to a simple
>                 add or sub.  This happens often for x86_64 guest when the
>                 cpu mode is set to 32 bit.  */
> -            if (dead_temps[args[1]]) {
> -                if (dead_temps[args[0]]) {
> +            if (dead_temps[args[1]] && !mem_temps[1]) {
> +                if (dead_temps[args[0]] && !mem_temps[0]) {

This should be mem_temps[args[1]] and mem_temps[args[0]] I believe.

>                      goto do_remove;
>                  }
>                  /* Create the single operation plus nop.  */
> @@ -1355,8 +1355,8 @@ static void tcg_liveness_analysis(TCGContext *s)
>              nb_iargs = 2;
>              nb_oargs = 2;
>              /* Likewise, test for the high part of the operation dead.  */
> -            if (dead_temps[args[1]]) {
> -                if (dead_temps[args[0]]) {
> +            if (dead_temps[args[1]] && !mem_temps[1]) {
> +                if (dead_temps[args[0]] && !mem_temps[0]) {

Same here.

>                      goto do_remove;
>                  }
>                  gen_opc_buf[op_index] = op = INDEX_op_mul_i32;

Looks like for x86_64 guest temp 0 is the env (always mem_temp), temp 1 -
cc_op. As a result it can accidentally remove high part of operation
when it is actually alive but will never optimize out whole operation
even if its output is really dead.

I've attached a small patch to fix this issue.

I was not able to boot gentoo install CD (amd64) with current trunk.
Boot process hangs soon after framebuffer initialization. With the patch
it boots successfully. Command line to reproduce:

qemu-system-x86_64 -cdrom install-amd64-minimal-20121013.iso

-- 
Kirill Batuzov

Attachment: tcg-properly-check-op-s-output.patch
Description: Text Data


reply via email to

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