]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fill in some missing cases:
authorJulian Seward <jseward@acm.org>
Fri, 15 Oct 2004 21:21:46 +0000 (21:21 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 15 Oct 2004 21:21:46 +0000 (21:21 +0000)
* Handle dirty helper calls in PutI/GetI transformations
* Add a few more constant folding rules

git-svn-id: svn://svn.valgrind.org/vex/trunk@348

VEX/priv/ir/iropt.c

index 52cd4e501cf7c1bf77c4cdd12cef204b0862e9c1..3084158ab5c78730f2b25f436c9a3960cdcdc874 100644 (file)
@@ -368,6 +368,11 @@ static IRExpr* fold_Expr ( IRExpr* e )
    if (e->tag == Iex_Unop
        && e->Iex.Unop.arg->tag == Iex_Const) {
       switch (e->Iex.Unop.op) {
+         case Iop_1Uto8:
+            e2 = IRExpr_Const(IRConst_U8(
+                    e->Iex.Unop.arg->Iex.Const.con->Ico.Bit
+                    ? 1 : 0));
+            break;
          case Iop_1Uto32:
             e2 = IRExpr_Const(IRConst_U32(
                     e->Iex.Unop.arg->Iex.Const.con->Ico.Bit
@@ -498,6 +503,11 @@ static IRExpr* fold_Expr ( IRExpr* e )
                        (e->Iex.Binop.arg1->Iex.Const.con->Ico.U32
                         == e->Iex.Binop.arg2->Iex.Const.con->Ico.U32)));
                break;
+            case Iop_CmpNE32:
+               e2 = IRExpr_Const(IRConst_Bit(
+                       (e->Iex.Binop.arg1->Iex.Const.con->Ico.U32
+                        != e->Iex.Binop.arg2->Iex.Const.con->Ico.U32)));
+               break;
             case Iop_32HLto64:
                e2 = IRExpr_Const(IRConst_U64(
                        (((ULong)(e->Iex.Binop.arg1->Iex.Const.con->Ico.U32)) << 32)
@@ -2431,8 +2441,13 @@ IRExpr* findPutI ( IRBB* bb, Int startHere,
 
       } /* if (st->tag == Ist_PutI) */
 
-      /* Figure out what to do here -- be conservative. */
-      vassert(st->tag != Ist_Dirty);
+      if (st->tag == Ist_Dirty) {
+         /* Be conservative.  If the dirty call has any guest effects at
+            all, give up.  We could do better -- only give up if there
+            are any guest writes/modifies. */
+         if (st->Ist.Dirty.details->nFxState > 0)
+            return NULL;
+      }
 
    } /* for */
 
@@ -2476,6 +2491,13 @@ Bool guestAccessWhichMightOverlapPutI (
    getArrayBounds(pi->Ist.PutI.descr, &minoffP, &maxoffP);
    switch (s2->tag) {
 
+      case Ist_Dirty:
+         /* If the dirty call has any guest effects at all, give up.
+            Probably could do better. */
+         if (s2->Ist.Dirty.details->nFxState > 0)
+            return True;
+         return False;
+
       case Ist_Put:
          vassert(isAtom(s2->Ist.Put.data));
          relation