From: Richard Kenner Date: Sat, 9 Apr 1994 20:05:15 +0000 (-0400) Subject: (fold): Avoid exponential work when simplifying conditional X-Git-Tag: misc/cutover-egcs-0~6933 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c64b884062ef166002a9482b43d0d29d4178698;p=thirdparty%2Fgcc.git (fold): Avoid exponential work when simplifying conditional expressions; don't recurse twice if ARG1 is constant. From-SVN: r7010 --- diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 81f7b4f03011..b3e7e1f8f23c 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3420,7 +3420,8 @@ fold (expr) tree lhs = fold (build (code, type, true_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)); arg1 = save_expr (arg1);