aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>2003-03-19 15:20:57 -0500
committerRichard Kenner <kenner@gcc.gnu.org>2003-03-19 15:20:57 -0500
commit784fb70e84d78a83a6599824b8b5e44eb85ba633 (patch)
tree1e2d109a16cdeb7ca8531b1ef3fa890c92d0982a /gcc/tree.c
parentf8a855dcaf51e388cf8fd34889441567f69a5602 (diff)
downloadgcc-784fb70e84d78a83a6599824b8b5e44eb85ba633.zip
gcc-784fb70e84d78a83a6599824b8b5e44eb85ba633.tar.gz
gcc-784fb70e84d78a83a6599824b8b5e44eb85ba633.tar.bz2
tree.c (substitute_in_expr, case 'e'): Only make recursive call on an operand if it has a PLACEHOLDER_EXPR.
* tree.c (substitute_in_expr, case 'e'): Only make recursive call on an operand if it has a PLACEHOLDER_EXPR. From-SVN: r64595
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 30a1c59..8cb27aa 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1890,8 +1890,13 @@ substitute_in_expr (exp, f, r)
else if (code == CONSTRUCTOR)
abort ();
- op0 = substitute_in_expr (TREE_OPERAND (exp, 0), f, r);
- op1 = substitute_in_expr (TREE_OPERAND (exp, 1), f, r);
+ op0 = TREE_OPERAND (exp, 0);
+ op1 = TREE_OPERAND (exp, 1);
+ if (contains_placeholder_p (op0))
+ op0 = substitute_in_expr (op0, f, r);
+ if (contains_placeholder_p (op1))
+ op1 = substitute_in_expr (op1, f, r);
+
if (op0 == TREE_OPERAND (exp, 0) && op1 == TREE_OPERAND (exp, 1))
return exp;
@@ -1917,9 +1922,17 @@ substitute_in_expr (exp, f, r)
else if (code != COND_EXPR)
abort ();
- op0 = substitute_in_expr (TREE_OPERAND (exp, 0), f, r);
- op1 = substitute_in_expr (TREE_OPERAND (exp, 1), f, r);
- op2 = substitute_in_expr (TREE_OPERAND (exp, 2), f, r);
+ op0 = TREE_OPERAND (exp, 0);
+ op1 = TREE_OPERAND (exp, 1);
+ op2 = TREE_OPERAND (exp, 2);
+
+ if (contains_placeholder_p (op0))
+ op0 = substitute_in_expr (op0, f, r);
+ if (contains_placeholder_p (op1))
+ op1 = substitute_in_expr (op1, f, r);
+ if (contains_placeholder_p (op2))
+ op2 = substitute_in_expr (op2, f, r);
+
if (op0 == TREE_OPERAND (exp, 0) && op1 == TREE_OPERAND (exp, 1)
&& op2 == TREE_OPERAND (exp, 2))
return exp;