5544c1b
From 2b8d0049e88c17749ccb978509d3f8fda180d35f Mon Sep 17 00:00:00 2001
5544c1b
From: Aurelien Jarno <aurelien@aurel32.net>
5544c1b
Date: Mon, 10 Sep 2012 13:14:12 +0200
5544c1b
Subject: [PATCH] revert "TCG: fix copy propagation"
5544c1b
5544c1b
Given the copy propagation breakage on 32-bit hosts has been fixed
5544c1b
commit e31b0a7c050711884ad570fe73df806520953618 can be reverted.
5544c1b
5544c1b
Cc: Blue Swirl <blauwirbel@gmail.com>
5544c1b
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
5544c1b
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1b
---
5544c1b
 tcg/optimize.c | 15 ++++++---------
5544c1b
 tcg/tcg.h      |  5 -----
5544c1b
 2 files changed, 6 insertions(+), 14 deletions(-)
5544c1b
5544c1b
diff --git a/tcg/optimize.c b/tcg/optimize.c
5544c1b
index fba0ed9..10d9773 100644
5544c1b
--- a/tcg/optimize.c
5544c1b
+++ b/tcg/optimize.c
5544c1b
@@ -107,15 +107,12 @@ static TCGOpcode op_to_movi(TCGOpcode op)
5544c1b
     }
5544c1b
 }
5544c1b
 
5544c1b
-static void tcg_opt_gen_mov(TCGContext *s, TCGArg *gen_args, TCGArg dst,
5544c1b
-                            TCGArg src, int nb_temps, int nb_globals)
5544c1b
+static void tcg_opt_gen_mov(TCGArg *gen_args, TCGArg dst, TCGArg src,
5544c1b
+                            int nb_temps, int nb_globals)
5544c1b
 {
5544c1b
         reset_temp(dst, nb_temps, nb_globals);
5544c1b
         assert(temps[src].state != TCG_TEMP_COPY);
5544c1b
-        /* Don't try to copy if one of temps is a global or either one
5544c1b
-           is local and another is register */
5544c1b
-        if (src >= nb_globals && dst >= nb_globals &&
5544c1b
-            tcg_arg_is_local(s, src) == tcg_arg_is_local(s, dst)) {
5544c1b
+        if (src >= nb_globals) {
5544c1b
             assert(temps[src].state != TCG_TEMP_CONST);
5544c1b
             if (temps[src].state != TCG_TEMP_HAS_COPY) {
5544c1b
                 temps[src].state = TCG_TEMP_HAS_COPY;
5544c1b
@@ -444,7 +441,7 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
5544c1b
                     gen_opc_buf[op_index] = INDEX_op_nop;
5544c1b
                 } else {
5544c1b
                     gen_opc_buf[op_index] = op_to_mov(op);
5544c1b
-                    tcg_opt_gen_mov(s, gen_args, args[0], args[1],
5544c1b
+                    tcg_opt_gen_mov(gen_args, args[0], args[1],
5544c1b
                                     nb_temps, nb_globals);
5544c1b
                     gen_args += 2;
5544c1b
                 }
5544c1b
@@ -482,7 +479,7 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
5544c1b
                     gen_opc_buf[op_index] = INDEX_op_nop;
5544c1b
                 } else {
5544c1b
                     gen_opc_buf[op_index] = op_to_mov(op);
5544c1b
-                    tcg_opt_gen_mov(s, gen_args, args[0], args[1], nb_temps,
5544c1b
+                    tcg_opt_gen_mov(gen_args, args[0], args[1], nb_temps,
5544c1b
                                     nb_globals);
5544c1b
                     gen_args += 2;
5544c1b
                 }
5544c1b
@@ -507,7 +504,7 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
5544c1b
                 break;
5544c1b
             }
5544c1b
             if (temps[args[1]].state != TCG_TEMP_CONST) {
5544c1b
-                tcg_opt_gen_mov(s, gen_args, args[0], args[1],
5544c1b
+                tcg_opt_gen_mov(gen_args, args[0], args[1],
5544c1b
                                 nb_temps, nb_globals);
5544c1b
                 gen_args += 2;
5544c1b
                 args += 2;
5544c1b
diff --git a/tcg/tcg.h b/tcg/tcg.h
5544c1b
index d710694..8fbbc81 100644
5544c1b
--- a/tcg/tcg.h
5544c1b
+++ b/tcg/tcg.h
5544c1b
@@ -458,11 +458,6 @@ static inline TCGv_i64 tcg_temp_local_new_i64(void)
5544c1b
 void tcg_temp_free_i64(TCGv_i64 arg);
5544c1b
 char *tcg_get_arg_str_i64(TCGContext *s, char *buf, int buf_size, TCGv_i64 arg);
5544c1b
 
5544c1b
-static inline bool tcg_arg_is_local(TCGContext *s, TCGArg arg)
5544c1b
-{
5544c1b
-    return s->temps[arg].temp_local;
5544c1b
-}
5544c1b
-
5544c1b
 #if defined(CONFIG_DEBUG_TCG)
5544c1b
 /* If you call tcg_clear_temp_count() at the start of a section of
5544c1b
  * code which is not supposed to leak any TCG temporaries, then