]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
mips: fix handling of Iex_ITE
authorPetar Jovanovic <mips32r2@gmail.com>
Tue, 17 Oct 2017 13:31:06 +0000 (15:31 +0200)
committerPetar Jovanovic <mips32r2@gmail.com>
Tue, 17 Oct 2017 13:31:06 +0000 (15:31 +0200)
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.

VEX/priv/host_mips_isel.c

index 711af6114055e2a5a41e573b588151d9d3681e69..3f08e55a5701a76c405c941b0e80be62392b6b0c 100644 (file)
@@ -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;
       }