Commit 9898deac by Richard Kenner

(const_binop, case *_DIV_EXPR): Don't do special sizetype case if a

constant overflows.

From-SVN: r13106
parent 1d58084a
...@@ -1171,6 +1171,8 @@ const_binop (code, arg1, arg2, notrunc) ...@@ -1171,6 +1171,8 @@ const_binop (code, arg1, arg2, notrunc)
and saves time. */ and saves time. */
if (int2h == 0 && int2l > 0 if (int2h == 0 && int2l > 0
&& TREE_TYPE (arg1) == sizetype && TREE_TYPE (arg1) == sizetype
&& ! TREE_CONSTANT_OVERFLOW (arg1)
&& ! TREE_CONSTANT_OVERFLOW (arg2)
&& int1h == 0 && int1l >= 0) && int1h == 0 && int1l >= 0)
{ {
if (code == CEIL_DIV_EXPR) if (code == CEIL_DIV_EXPR)
...@@ -1445,18 +1447,14 @@ size_binop (code, arg0, arg1) ...@@ -1445,18 +1447,14 @@ size_binop (code, arg0, arg1)
if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST) if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST)
{ {
/* And some specific cases even faster than that. */ /* And some specific cases even faster than that. */
if (code == PLUS_EXPR if (code == PLUS_EXPR && integer_zerop (arg0))
&& TREE_INT_CST_LOW (arg0) == 0
&& TREE_INT_CST_HIGH (arg0) == 0)
return arg1; return arg1;
if (code == MINUS_EXPR else if ((code == MINUS_EXPR || code == PLUS_EXPR)
&& TREE_INT_CST_LOW (arg1) == 0 && integer_zerop (arg1))
&& TREE_INT_CST_HIGH (arg1) == 0)
return arg0; return arg0;
if (code == MULT_EXPR else if (code == MULT_EXPR && integer_onep (arg0))
&& TREE_INT_CST_LOW (arg0) == 1
&& TREE_INT_CST_HIGH (arg0) == 0)
return arg1; return arg1;
/* Handle general case of two integer constants. */ /* Handle general case of two integer constants. */
return const_binop (code, arg0, arg1, 0); return const_binop (code, arg0, arg1, 0);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment