From: Petar Jovanovic Date: Fri, 17 Apr 2020 18:02:39 +0000 (+0000) Subject: mips: update VEX to support speculative conditional branching X-Git-Tag: VALGRIND_3_16_0~51 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8bd259eb14d884009e2e51e6ad5834c06d193e17;p=thirdparty%2Fvalgrind.git mips: update VEX to support speculative conditional branching This partially fixes KDE #417187. --- diff --git a/VEX/priv/guest_generic_bb_to_IR.c b/VEX/priv/guest_generic_bb_to_IR.c index 5932eb8043..2f204c5b0a 100644 --- a/VEX/priv/guest_generic_bb_to_IR.c +++ b/VEX/priv/guest_generic_bb_to_IR.c @@ -1448,10 +1448,7 @@ IRSB* bb_to_IR ( // Try for an extend based on a conditional branch, specifically in the // hope of identifying and recovering, an "A && B" condition spread across // two basic blocks. - if (irsb_be.tag == Be_Cond - /* sewardj 2019Dec14: It also causes crashing on MIPS, even for - --tool=none. */ - && arch_guest != VexArchMIPS64 && arch_guest != VexArchMIPS32) + if (irsb_be.tag == Be_Cond) { if (debug_print) { vex_printf("\n-+-+ (ext# %d) Considering cbranch to" diff --git a/VEX/priv/host_mips_isel.c b/VEX/priv/host_mips_isel.c index 51ac757731..899c7868e0 100644 --- a/VEX/priv/host_mips_isel.c +++ b/VEX/priv/host_mips_isel.c @@ -2366,13 +2366,9 @@ static HReg iselWordExpr_R_wrk(ISelEnv * env, IRExpr * e) case Ico_U8: l = (Long) (Int) (Char) con->Ico.U8; break; -#if 0 - // Not needed until chasing cond branches in bb_to_IR is enabled on - // MIPS. See comment on And1/Or1 below. case Ico_U1: l = con->Ico.U1 ? 1 : 0; break; -#endif default: vpanic("iselIntExpr_R.const(mips)"); } @@ -2773,11 +2769,7 @@ static MIPSCondCode iselCondCode_wrk(ISelEnv * env, IRExpr * e) r_dst, mode64)); return MIPScc_NE; } -#if 0 - // sewardj 2019Dec14: this is my best attempt at And1/Or1, but I am not - // sure if it is correct. In any case it is not needed until chasing cond - // branches is enabled on MIPS. Currently it is disabled, in function bb_to_IR - // (see comments there). + if (e->tag == Iex_Binop && (e->Iex.Binop.op == Iop_And1 || e->Iex.Binop.op == Iop_Or1)) { HReg r_argL = iselWordExpr_R(env, e->Iex.Binop.arg1); @@ -2798,7 +2790,7 @@ static MIPSCondCode iselCondCode_wrk(ISelEnv * env, IRExpr * e) r_dst, mode64)); return MIPScc_EQ; } -#endif + if (e->tag == Iex_RdTmp) { HReg r_dst = iselWordExpr_R_wrk(env, e); /* Store result to guest_COND */