diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1994-04-09 16:05:15 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1994-04-09 16:05:15 -0400 |
commit | 4c64b884062ef166002a9482b43d0d29d4178698 (patch) | |
tree | b2700d5ccf074811c5f9f3d7535ebcced68252a6 /gcc/fold-const.c | |
parent | f767bd6ef95d99b443f02cdb6f388c457cc105ee (diff) | |
download | gcc-4c64b884062ef166002a9482b43d0d29d4178698.zip gcc-4c64b884062ef166002a9482b43d0d29d4178698.tar.gz gcc-4c64b884062ef166002a9482b43d0d29d4178698.tar.bz2 |
(fold): Avoid exponential work when simplifying conditional
expressions; don't recurse twice if ARG1 is constant.
From-SVN: r7010
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 81f7b4f..b3e7e1f 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); |