From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTj4P-0006e2-Iv for qemu-devel@nongnu.org; Sun, 31 Jul 2016 01:13:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bTj4M-0002jn-EJ for qemu-devel@nongnu.org; Sun, 31 Jul 2016 01:13:49 -0400 From: Benjamin Herrenschmidt Date: Sun, 31 Jul 2016 15:13:09 +1000 Message-Id: <1469941993-27576-1-git-send-email-benh@kernel.crashing.org> Subject: [Qemu-devel] [PATCH 1/5] ppc: Don't generate dead code on unconditional branches List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-ppc@nongnu.org Cc: qemu-devel@nongnu.org, david@gibson.dropbear.id.au, Richard Henderson , Benjamin Herrenschmidt We are always generating the "else" case of the condition even when generating an unconditional branch that will never hit it. Signed-off-by: Benjamin Herrenschmidt --- target-ppc/translate.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/target-ppc/translate.c b/target-ppc/translate.c index d1837f8..47eb9ed 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -3479,8 +3479,10 @@ static inline void gen_bcond(DisasContext *ctx, int type) } else { gen_goto_tb(ctx, 0, li); } - gen_set_label(l1); - gen_goto_tb(ctx, 1, ctx->nip); + if ((bo & 0x14) != 0x14) { + gen_set_label(l1); + gen_goto_tb(ctx, 1, ctx->nip); + } } else { if (NARROW_MODE(ctx)) { tcg_gen_andi_tl(cpu_nip, target, (uint32_t)~3); @@ -3488,9 +3490,11 @@ static inline void gen_bcond(DisasContext *ctx, int type) tcg_gen_andi_tl(cpu_nip, target, ~3); } tcg_gen_exit_tb(0); - gen_set_label(l1); - gen_update_nip(ctx, ctx->nip); - tcg_gen_exit_tb(0); + if ((bo & 0x14) != 0x14) { + gen_set_label(l1); + gen_update_nip(ctx, ctx->nip); + tcg_gen_exit_tb(0); + } } if (type == BCOND_LR || type == BCOND_CTR || type == BCOND_TAR) { tcg_temp_free(target); -- 2.7.4