Commit accc60c4 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by David Gibson
Browse files

ppc: Don't generate dead code on unconditional branches



We are always generating the "else" case of the condition even when
generating an unconditional branch that will never hit it.

Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: default avatarRichard Henderson <rth@twiddle.net>
Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
parent 4f5d3260
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -3480,8 +3480,10 @@ static inline void gen_bcond(DisasContext *ctx, int type)
        } else {
            gen_goto_tb(ctx, 0, li);
        }
        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);
@@ -3489,10 +3491,12 @@ static inline void gen_bcond(DisasContext *ctx, int type)
            tcg_gen_andi_tl(cpu_nip, target, ~3);
        }
        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);
    }