Patchwork [08/15] tcg/optimize: fix setcond2 optimization

login
register
mail settings
Submitter Michael Roth
Date May 14, 2013, 9:53 p.m.
Message ID <1368568392-2127-9-git-send-email-mdroth@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/243847/
State New
Headers show

Comments

Michael Roth - May 14, 2013, 9:53 p.m.
From: Aurelien Jarno <aurelien@aurel32.net>

When setcond2 is rewritten into setcond, the state of the destination
temp should be reset, so that a copy of the previous value is not
used instead of the result.

Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 66e61b55f158ef5628e4c056dd2f233c9351a3f5)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 tcg/optimize.c |    1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/tcg/optimize.c b/tcg/optimize.c
index 973d2d6..be10033 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1024,6 +1024,7 @@  static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
                 /* Simplify LT/GE comparisons vs zero to a single compare
                    vs the high word of the input.  */
                 s->gen_opc_buf[op_index] = INDEX_op_setcond_i32;
+                reset_temp(args[0]);
                 gen_args[0] = args[0];
                 gen_args[1] = args[2];
                 gen_args[2] = args[4];