Change requested in launchpad bug #1288352
[packages/centos6/qemu.git] / 0042-revert-TCG-fix-copy-propagation.patch
1 From 2b8d0049e88c17749ccb978509d3f8fda180d35f Mon Sep 17 00:00:00 2001
2 From: Aurelien Jarno <aurelien@aurel32.net>
3 Date: Mon, 10 Sep 2012 13:14:12 +0200
4 Subject: [PATCH] revert "TCG: fix copy propagation"
5
6 Given the copy propagation breakage on 32-bit hosts has been fixed
7 commit e31b0a7c050711884ad570fe73df806520953618 can be reverted.
8
9 Cc: Blue Swirl <blauwirbel@gmail.com>
10 Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 ---
13  tcg/optimize.c | 15 ++++++---------
14  tcg/tcg.h      |  5 -----
15  2 files changed, 6 insertions(+), 14 deletions(-)
16
17 diff --git a/tcg/optimize.c b/tcg/optimize.c
18 index fba0ed9..10d9773 100644
19 --- a/tcg/optimize.c
20 +++ b/tcg/optimize.c
21 @@ -107,15 +107,12 @@ static TCGOpcode op_to_movi(TCGOpcode op)
22      }
23  }
24  
25 -static void tcg_opt_gen_mov(TCGContext *s, TCGArg *gen_args, TCGArg dst,
26 -                            TCGArg src, int nb_temps, int nb_globals)
27 +static void tcg_opt_gen_mov(TCGArg *gen_args, TCGArg dst, TCGArg src,
28 +                            int nb_temps, int nb_globals)
29  {
30          reset_temp(dst, nb_temps, nb_globals);
31          assert(temps[src].state != TCG_TEMP_COPY);
32 -        /* Don't try to copy if one of temps is a global or either one
33 -           is local and another is register */
34 -        if (src >= nb_globals && dst >= nb_globals &&
35 -            tcg_arg_is_local(s, src) == tcg_arg_is_local(s, dst)) {
36 +        if (src >= nb_globals) {
37              assert(temps[src].state != TCG_TEMP_CONST);
38              if (temps[src].state != TCG_TEMP_HAS_COPY) {
39                  temps[src].state = TCG_TEMP_HAS_COPY;
40 @@ -444,7 +441,7 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
41                      gen_opc_buf[op_index] = INDEX_op_nop;
42                  } else {
43                      gen_opc_buf[op_index] = op_to_mov(op);
44 -                    tcg_opt_gen_mov(s, gen_args, args[0], args[1],
45 +                    tcg_opt_gen_mov(gen_args, args[0], args[1],
46                                      nb_temps, nb_globals);
47                      gen_args += 2;
48                  }
49 @@ -482,7 +479,7 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
50                      gen_opc_buf[op_index] = INDEX_op_nop;
51                  } else {
52                      gen_opc_buf[op_index] = op_to_mov(op);
53 -                    tcg_opt_gen_mov(s, gen_args, args[0], args[1], nb_temps,
54 +                    tcg_opt_gen_mov(gen_args, args[0], args[1], nb_temps,
55                                      nb_globals);
56                      gen_args += 2;
57                  }
58 @@ -507,7 +504,7 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
59                  break;
60              }
61              if (temps[args[1]].state != TCG_TEMP_CONST) {
62 -                tcg_opt_gen_mov(s, gen_args, args[0], args[1],
63 +                tcg_opt_gen_mov(gen_args, args[0], args[1],
64                                  nb_temps, nb_globals);
65                  gen_args += 2;
66                  args += 2;
67 diff --git a/tcg/tcg.h b/tcg/tcg.h
68 index d710694..8fbbc81 100644
69 --- a/tcg/tcg.h
70 +++ b/tcg/tcg.h
71 @@ -458,11 +458,6 @@ static inline TCGv_i64 tcg_temp_local_new_i64(void)
72  void tcg_temp_free_i64(TCGv_i64 arg);
73  char *tcg_get_arg_str_i64(TCGContext *s, char *buf, int buf_size, TCGv_i64 arg);
74  
75 -static inline bool tcg_arg_is_local(TCGContext *s, TCGArg arg)
76 -{
77 -    return s->temps[arg].temp_local;
78 -}
79 -
80  #if defined(CONFIG_DEBUG_TCG)
81  /* If you call tcg_clear_temp_count() at the start of a section of
82   * code which is not supposed to leak any TCG temporaries, then
83 -- 
84 1.7.12.1
85