From: Petar Jovanovic Date: Tue, 17 Oct 2017 13:31:06 +0000 (+0200) Subject: mips: fix handling of Iex_ITE X-Git-Tag: VALGRIND_3_14_0~226 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2cf115e6570675a3af3fba9bbbb6d65826b7f512;p=thirdparty%2Fvalgrind.git mips: fix handling of Iex_ITE While handling Iex_ITE, do not use the same virtual register for the input and output. Issue discovered while testing Valgrind on Android. Patch by Tamara Vlahovic. --- diff --git a/VEX/priv/host_mips_isel.c b/VEX/priv/host_mips_isel.c index 711af61140..3f08e55a57 100644 --- a/VEX/priv/host_mips_isel.c +++ b/VEX/priv/host_mips_isel.c @@ -1784,13 +1784,15 @@ static HReg iselWordExpr_R_wrk(ISelEnv * env, IRExpr * e) if ((ty == Ity_I8 || ty == Ity_I16 || ty == Ity_I32 || ((ty == Ity_I64))) && typeOfIRExpr(env->type_env, e->Iex.ITE.cond) == Ity_I1) { - HReg r_dst = iselWordExpr_R(env, e->Iex.ITE.iffalse); + HReg r0 = iselWordExpr_R(env, e->Iex.ITE.iffalse); HReg r1 = iselWordExpr_R(env, e->Iex.ITE.iftrue); HReg r_cond = iselWordExpr_R(env, e->Iex.ITE.cond); + HReg r_dst = newVRegI(env); /* * r_dst = r0 * movn r_dst, r1, r_cond */ + addInstr(env, mk_iMOVds_RR(r_dst, r0)); addInstr(env, MIPSInstr_MoveCond(MMoveCond_movn, r_dst, r1, r_cond)); return r_dst; }