]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
fold_Expr: do Shl32(x,0) ==> x
authorJulian Seward <jseward@acm.org>
Wed, 13 Oct 2004 16:08:14 +0000 (16:08 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 13 Oct 2004 16:08:14 +0000 (16:08 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@326

VEX/priv/ir/iropt.c

index 7903bd2d09424f01cabd45d3d9e336bcddf5a5c3..b352bf7e74622be35b3bd066d049b4c90c2fdaf3 100644 (file)
@@ -495,6 +495,13 @@ static IRExpr* fold_Expr ( IRExpr* e )
       } else {
 
          /* other cases (identities, etc) */
+         /* Shl32(x,0) ==> x */
+         if (e->Iex.Binop.op == Iop_Shl32
+             && e->Iex.Binop.arg2->tag == Iex_Const
+             && e->Iex.Binop.arg2->Iex.Const.con->Ico.U32 == 0) {
+            e2 = e->Iex.Binop.arg1;
+         } else
+
          /* Add32(x,0) ==> x */
          if (e->Iex.Binop.op == Iop_Add32
              && e->Iex.Binop.arg2->tag == Iex_Const