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

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