diff options
author | Aurelien Jarno <aurelien@aurel32.net> | 2012-09-19 21:40:30 +0200 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2012-09-19 21:53:46 +0200 |
commit | a25506603914d706f4ac4c63d3b93b4f1227b9b4 (patch) | |
tree | a71aac264d835124e662d94c8ef51d4040098f4f /tcg | |
parent | bd277fa1966bc400f1b411f868f39125cda0c403 (diff) | |
download | qemu-a25506603914d706f4ac4c63d3b93b4f1227b9b4.zip qemu-a25506603914d706f4ac4c63d3b93b4f1227b9b4.tar.gz qemu-a25506603914d706f4ac4c63d3b93b4f1227b9b4.tar.bz2 |
tcg/optimize: fix end of basic block detection
Commit e31b0a7c050711884ad570fe73df806520953618 fixed copy propagation on
32-bit host by restricting the copy between different types. This was the
wrong fix.
The real problem is that the all temps states should be reset at the end
of a basic block. This was done by adding such operations in the switch,
but brcond2 was forgotten (that's why the crash was only observed on 32-bit
hosts).
Fix that by looking at the TCG_OPF_BB_END instead. We need to keep the case
for op_set_label as temps might be modified through another path.
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'tcg')
-rw-r--r-- | tcg/optimize.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c index 10d9773..9da333c 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -632,21 +632,17 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr, i--; } break; - case INDEX_op_set_label: - case INDEX_op_jmp: - case INDEX_op_br: - memset(temps, 0, nb_temps * sizeof(struct tcg_temp_info)); - for (i = 0; i < def->nb_args; i++) { - *gen_args = *args; - args++; - gen_args++; - } - break; default: /* Default case: we do know nothing about operation so no - propagation is done. We only trash output args. */ - for (i = 0; i < def->nb_oargs; i++) { - reset_temp(args[i], nb_temps, nb_globals); + propagation is done. We trash everything if the operation + is the end of a basic block, otherwise we only trash the + output args. */ + if (def->flags & TCG_OPF_BB_END) { + memset(temps, 0, nb_temps * sizeof(struct tcg_temp_info)); + } else { + for (i = 0; i < def->nb_oargs; i++) { + reset_temp(args[i], nb_temps, nb_globals); + } } for (i = 0; i < def->nb_args; i++) { gen_args[i] = args[i]; |