Commit 4c64b884 by Richard Kenner

(fold): Avoid exponential work when simplifying conditional

expressions; don't recurse twice if ARG1 is constant.

From-SVN: r7010
parent f767bd6e
...@@ -3420,7 +3420,8 @@ fold (expr) ...@@ -3420,7 +3420,8 @@ fold (expr)
tree lhs = fold (build (code, type, true_value, arg1)); tree lhs = fold (build (code, type, true_value, arg1));
tree rhs = fold (build (code, type, false_value, arg1)); tree rhs = fold (build (code, type, false_value, arg1));
if (TREE_CONSTANT (lhs) || TREE_CONSTANT (rhs)) if (TREE_CONSTANT (lhs) || TREE_CONSTANT (rhs)
|| TREE_CONSTANT (arg1))
return fold (build (COND_EXPR, type, test, lhs, rhs)); return fold (build (COND_EXPR, type, test, lhs, rhs));
arg1 = save_expr (arg1); arg1 = save_expr (arg1);
......
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