Blame SOURCES/valgrind-3.16.0-387-float.patch

fe1059
commit 6aa4f7e7e76b40c183fb29650540d119ce1b4a4a
fe1059
Author: Julian Seward <jseward@acm.org>
fe1059
Date:   Thu Jun 11 09:01:52 2020 +0200
fe1059
fe1059
    expr_is_guardable, stmt_is_guardable, add_guarded_stmt_to_end_of: handle GetI/PutI cases.
fe1059
    
fe1059
    This fixes #422715.
fe1059
fe1059
diff --git a/VEX/priv/guest_generic_bb_to_IR.c b/VEX/priv/guest_generic_bb_to_IR.c
fe1059
index 2f204c5b0..0cee970e4 100644
fe1059
--- a/VEX/priv/guest_generic_bb_to_IR.c
fe1059
+++ b/VEX/priv/guest_generic_bb_to_IR.c
fe1059
@@ -425,6 +425,7 @@ static Bool expr_is_guardable ( const IRExpr* e )
fe1059
       case Iex_ITE:
fe1059
       case Iex_CCall:
fe1059
       case Iex_Get:
fe1059
+      case Iex_GetI:
fe1059
       case Iex_Const:
fe1059
       case Iex_RdTmp:
fe1059
          return True;
fe1059
@@ -450,6 +451,7 @@ static Bool stmt_is_guardable ( const IRStmt* st )
fe1059
       case Ist_NoOp:
fe1059
       case Ist_IMark:
fe1059
       case Ist_Put:
fe1059
+      case Ist_PutI:
fe1059
          return True;
fe1059
       // These are definitely not guardable, or at least it's way too much
fe1059
       // hassle to do so.
fe1059
@@ -506,7 +508,7 @@ static void add_guarded_stmt_to_end_of ( /*MOD*/IRSB* bb,
fe1059
          // Put(offs, e) ==> Put(offs, ITE(guard, e, Get(offs, sizeof(e))))
fe1059
          // Which when flattened out is:
fe1059
          //   t1 = Get(offs, sizeof(e))
fe1059
-         //   t2 = ITE(guard, e, t2)
fe1059
+         //   t2 = ITE(guard, e, t1)
fe1059
          //   Put(offs, t2)
fe1059
          Int offset = st->Ist.Put.offset;
fe1059
          IRExpr* e = st->Ist.Put.data;
fe1059
@@ -519,6 +521,26 @@ static void add_guarded_stmt_to_end_of ( /*MOD*/IRSB* bb,
fe1059
          addStmtToIRSB(bb, IRStmt_Put(offset, IRExpr_RdTmp(t2)));
fe1059
          break;
fe1059
       }
fe1059
+      case Ist_PutI: {
fe1059
+         // PutI(descr,ix,bias, e) ==> Put(descr,ix,bias, ITE(guard, e, GetI(descr,ix,bias)))
fe1059
+         // Which when flattened out is:
fe1059
+         //   t1 = GetI(descr,ix,bias)
fe1059
+         //   t2 = ITE(guard, e, t1)
fe1059
+         //   PutI(descr,ix,bias, t2)
fe1059
+         IRPutI*     details = st->Ist.PutI.details;
fe1059
+         IRRegArray* descr   = details->descr;
fe1059
+         IRExpr*     ix      = details->ix;
fe1059
+         Int         bias    = details->bias;
fe1059
+         IRExpr*     e       = details->data;
fe1059
+         IRType ty = typeOfIRExpr(bb->tyenv, e);
fe1059
+         IRTemp t1 = newIRTemp(bb->tyenv, ty);
fe1059
+         IRTemp t2 = newIRTemp(bb->tyenv, ty);
fe1059
+         addStmtToIRSB(bb, IRStmt_WrTmp(t1, IRExpr_GetI(descr,ix,bias)));
fe1059
+         addStmtToIRSB(bb, IRStmt_WrTmp(t2, IRExpr_ITE(IRExpr_RdTmp(guard),
fe1059
+                                                       e, IRExpr_RdTmp(t1))));
fe1059
+         addStmtToIRSB(bb, IRStmt_PutI(mkIRPutI(descr,ix,bias, IRExpr_RdTmp(t2))));
fe1059
+         break;
fe1059
+      }
fe1059
       case Ist_Exit: {
fe1059
          // Exit(xguard, dst, jk, offsIP)
fe1059
          // ==> t1 = And1(xguard, guard)