Skip to content

Commit

Permalink
ppc: Don't generate dead code on unconditional branches
Browse files Browse the repository at this point in the history
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 <benh@kernel.crashing.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
  • Loading branch information
ozbenh authored and dgibson committed Sep 7, 2016
1 parent 4f5d326 commit accc60c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions target-ppc/translate.c
Expand Up @@ -3480,18 +3480,22 @@ 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);
} else {
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);
Expand Down

0 comments on commit accc60c

Please sign in to comment.