aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2005-03-06 02:25:03 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2005-03-06 02:25:03 +0000
commit7104730324dd854cf0280494f941854c50299312 (patch)
tree2ddf3fc3749d103ac00f2b290bd509f6a51a199c /gcc
parent75505450f647279fc6fecc603cedf6702c871dc2 (diff)
downloadgcc-7104730324dd854cf0280494f941854c50299312.zip
gcc-7104730324dd854cf0280494f941854c50299312.tar.gz
gcc-7104730324dd854cf0280494f941854c50299312.tar.bz2
fold-const.c (fold_binary): Avoid directly using the original expression t as much as possible.
* fold-const.c (fold_binary): Avoid directly using the original expression t as much as possible. From-SVN: r95962
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/fold-const.c14
2 files changed, 12 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e6c7fa8..8e25962 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2005-03-06 Kazu Hirata <kazu@cs.umass.edu>
+
+ * fold-const.c (fold_binary): Avoid directly using the original
+ expression t as much as possible.
+
2005-03-05 Kazu Hirata <kazu@cs.umass.edu>
* c-semantics.c (build_stmt): Use TYPE_P instead of
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 04f56eb..2577da2 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -7025,6 +7025,7 @@ fold_binary (tree expr)
const tree type = TREE_TYPE (expr);
tree t1 = NULL_TREE;
tree tem;
+ tree op0, op1;
tree arg0 = NULL_TREE, arg1 = NULL_TREE;
enum tree_code code = TREE_CODE (t);
enum tree_code_class kind = TREE_CODE_CLASS (code);
@@ -7037,6 +7038,8 @@ fold_binary (tree expr)
gcc_assert (IS_EXPR_CODE_CLASS (kind)
&& TREE_CODE_LENGTH (code) == 2);
+ op0 = TREE_OPERAND (t, 0);
+ op1 = TREE_OPERAND (t, 1);
for (i = 0; i < 2; i++)
{
tree op = TREE_OPERAND (t, i);
@@ -7083,8 +7086,7 @@ fold_binary (tree expr)
to ARG1 to reduce the number of tests below. */
if (commutative_tree_code (code)
&& tree_swap_operands_p (arg0, arg1, true))
- return fold (build2 (code, type, TREE_OPERAND (t, 1),
- TREE_OPERAND (t, 0)));
+ return fold (build2 (code, type, op1, op0));
/* Now WINS is set as described above,
ARG0 is the first operand of EXPR,
@@ -7784,7 +7786,7 @@ fold_binary (tree expr)
TREE_OPERAND (arg0, 1)));
if (TREE_CODE (arg1) == INTEGER_CST
- && 0 != (tem = extract_muldiv (TREE_OPERAND (t, 0),
+ && 0 != (tem = extract_muldiv (op0,
fold_convert (type, arg1),
code, NULL_TREE)))
return fold_convert (type, tem);
@@ -8343,8 +8345,7 @@ fold_binary (tree expr)
return fold (build2 (EXACT_DIV_EXPR, type, arg0, arg1));
if (TREE_CODE (arg1) == INTEGER_CST
- && 0 != (tem = extract_muldiv (TREE_OPERAND (t, 0), arg1,
- code, NULL_TREE)))
+ && 0 != (tem = extract_muldiv (op0, arg1, code, NULL_TREE)))
return fold_convert (type, tem);
if (TREE_CODE (type) == COMPLEX_TYPE)
@@ -8429,8 +8430,7 @@ fold_binary (tree expr)
fold_convert (type, TREE_OPERAND (arg1, 0))));
if (TREE_CODE (arg1) == INTEGER_CST
- && 0 != (tem = extract_muldiv (TREE_OPERAND (t, 0), arg1,
- code, NULL_TREE)))
+ && 0 != (tem = extract_muldiv (op0, arg1, code, NULL_TREE)))
return fold_convert (type, tem);
goto binary;