diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-16 12:45:13 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-16 12:45:13 +0000 |
commit | 48b6f9afd5649f78aeb5fe9eb6f77cba68d3f579 (patch) | |
tree | 91128e51e2ee70c6de304c65a21cfae0c68c35f8 /gcc/expr.c | |
parent | 06506f5d6786073737eb17f5cc7b346b67489a71 (diff) | |
download | ppe42-gcc-48b6f9afd5649f78aeb5fe9eb6f77cba68d3f579.tar.gz ppe42-gcc-48b6f9afd5649f78aeb5fe9eb6f77cba68d3f579.zip |
* expr.c (expand_expr <PLUS_EXPR>): If operand_equal_p considers
both operands of the addition equal, reuse the expanded RTL.
(expand_expr <MULT_EXPR>): Likewise for multiplication.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68012 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/expr.c b/gcc/expr.c index 3131a33e50d..83240c682da 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -8226,7 +8226,11 @@ expand_expr (exp, target, tmode, modifier) || mode != ptr_mode) { op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0); - op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0); + if (! operand_equal_p (TREE_OPERAND (exp, 0), + TREE_OPERAND (exp, 1), 0)) + op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0); + else + op1 = op0; if (op0 == const0_rtx) return op1; if (op1 == const0_rtx) @@ -8235,7 +8239,12 @@ expand_expr (exp, target, tmode, modifier) } op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, modifier); - op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, modifier); + if (! operand_equal_p (TREE_OPERAND (exp, 0), + TREE_OPERAND (exp, 1), 0)) + op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, + VOIDmode, modifier); + else + op1 = op0; /* We come here from MINUS_EXPR when the second operand is a constant. */ @@ -8457,7 +8466,11 @@ expand_expr (exp, target, tmode, modifier) } } op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0); - op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0); + if (! operand_equal_p (TREE_OPERAND (exp, 0), + TREE_OPERAND (exp, 1), 0)) + op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0); + else + op1 = op0; return expand_mult (mode, op0, op1, target, unsignedp); case TRUNC_DIV_EXPR: |