Add a couple more constant folding rules.
git-svn-id: svn://svn.valgrind.org/vex/trunk@547 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/ir/iropt.c b/priv/ir/iropt.c
index 9f692c9..b9372e2 100644
--- a/priv/ir/iropt.c
+++ b/priv/ir/iropt.c
@@ -342,6 +342,13 @@
&& e1->Iex.Tmp.tmp == e2->Iex.Tmp.tmp;
}
+static Bool notBool ( Bool b )
+{
+ if (b == True) return False;
+ if (b == False) return True;
+ vpanic("notBool");
+}
+
static IRExpr* fold_Expr ( IRExpr* e )
{
Int shift;
@@ -415,6 +422,11 @@
~ (e->Iex.Unop.arg->Iex.Const.con->Ico.U8)));
break;
+ case Iop_Not1:
+ e2 = IRExpr_Const(IRConst_Bit(
+ notBool(e->Iex.Unop.arg->Iex.Const.con->Ico.Bit)));
+ break;
+
default:
goto unhandled;
}
@@ -555,11 +567,17 @@
((Int)(e->Iex.Binop.arg1->Iex.Const.con->Ico.U32)
<= (Int)(e->Iex.Binop.arg2->Iex.Const.con->Ico.U32))));
break;
+
case Iop_CmpLT32S:
e2 = IRExpr_Const(IRConst_Bit(
((Int)(e->Iex.Binop.arg1->Iex.Const.con->Ico.U32)
< (Int)(e->Iex.Binop.arg2->Iex.Const.con->Ico.U32))));
break;
+ case Iop_CmpLT32U:
+ e2 = IRExpr_Const(IRConst_Bit(
+ ((UInt)(e->Iex.Binop.arg1->Iex.Const.con->Ico.U32)
+ < (UInt)(e->Iex.Binop.arg2->Iex.Const.con->Ico.U32))));
+ break;
case Iop_32HLto64:
e2 = IRExpr_Const(IRConst_U64(