diff options
author | James A. Morrison <phython@gcc.gnu.org> | 2005-08-09 04:24:56 +0000 |
---|---|---|
committer | James A. Morrison <phython@gcc.gnu.org> | 2005-08-09 04:24:56 +0000 |
commit | 2f133f4681a88304902476384965eb214ddf7a9d (patch) | |
tree | fbfcd859174fdbaed058790f4ba71524cea74b2a /gcc/tree-ssa-loop-niter.c | |
parent | f14e694e82ff0a1aff4a9b8da707fda2209fded7 (diff) | |
download | gcc-2f133f4681a88304902476384965eb214ddf7a9d.zip gcc-2f133f4681a88304902476384965eb214ddf7a9d.tar.gz gcc-2f133f4681a88304902476384965eb214ddf7a9d.tar.bz2 |
tree-ssa-loop-niter.c (tree_simplify_using_condition_1): Use fold_binary instead of fold_build2 since we don't care about the resulting tree.
2005-08-09 James A. Morrison <phython@gcc.gnu.org>
* tree-ssa-loop-niter.c (tree_simplify_using_condition_1): Use
fold_binary instead of fold_build2 since we don't care about the
resulting tree.
(loop_niter_by_eval): Likewise.
(compare_trees): Likewise.
(proved_non_wrapping_p): Likewise.
From-SVN: r102897
Diffstat (limited to 'gcc/tree-ssa-loop-niter.c')
-rw-r--r-- | gcc/tree-ssa-loop-niter.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 37cd400..21dc9ec 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -778,13 +778,13 @@ tree_simplify_using_condition_1 (tree cond, tree expr) /* Check whether COND ==> EXPR. */ notcond = invert_truthvalue (cond); - e = fold_build2 (TRUTH_OR_EXPR, boolean_type_node, notcond, te); + e = fold_binary (TRUTH_OR_EXPR, boolean_type_node, notcond, te); if (nonzero_p (e)) return e; /* Check whether COND ==> not EXPR. */ - e = fold_build2 (TRUTH_AND_EXPR, boolean_type_node, cond, te); - if (zero_p (e)) + e = fold_binary (TRUTH_AND_EXPR, boolean_type_node, cond, te); + if (e && zero_p (e)) return e; return expr; @@ -1296,8 +1296,8 @@ loop_niter_by_eval (struct loop *loop, edge exit) for (j = 0; j < 2; j++) aval[j] = get_val_for (op[j], val[j]); - acnd = fold_build2 (cmp, boolean_type_node, aval[0], aval[1]); - if (zero_p (acnd)) + acnd = fold_binary (cmp, boolean_type_node, aval[0], aval[1]); + if (acnd && zero_p (acnd)) { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, @@ -1462,11 +1462,11 @@ compare_trees (tree a, tree b) a = fold_convert (type, a); b = fold_convert (type, b); - if (nonzero_p (fold_build2 (EQ_EXPR, boolean_type_node, a, b))) + if (nonzero_p (fold_binary (EQ_EXPR, boolean_type_node, a, b))) return 0; - if (nonzero_p (fold_build2 (LT_EXPR, boolean_type_node, a, b))) + if (nonzero_p (fold_binary (LT_EXPR, boolean_type_node, a, b))) return 1; - if (nonzero_p (fold_build2 (GT_EXPR, boolean_type_node, a, b))) + if (nonzero_p (fold_binary (GT_EXPR, boolean_type_node, a, b))) return -1; return 2; @@ -1530,6 +1530,7 @@ proved_non_wrapping_p (tree at_stmt, { tree cond; tree bound = niter_bound->bound; + enum tree_code cmp; if (TYPE_PRECISION (new_type) > TYPE_PRECISION (TREE_TYPE (bound))) bound = fold_convert (unsigned_type_for (new_type), bound); @@ -1539,18 +1540,19 @@ proved_non_wrapping_p (tree at_stmt, /* After the statement niter_bound->at_stmt we know that anything is executed at most BOUND times. */ if (at_stmt && stmt_dominates_stmt_p (niter_bound->at_stmt, at_stmt)) - cond = fold_build2 (GE_EXPR, boolean_type_node, valid_niter, bound); - + cmp = GE_EXPR; /* Before the statement niter_bound->at_stmt we know that anything is executed at most BOUND + 1 times. */ else - cond = fold_build2 (GT_EXPR, boolean_type_node, valid_niter, bound); + cmp = GT_EXPR; + cond = fold_binary (cmp, boolean_type_node, valid_niter, bound); if (nonzero_p (cond)) return true; + cond = build2 (cmp, boolean_type_node, valid_niter, bound); /* Try taking additional conditions into account. */ - cond = fold_build2 (TRUTH_OR_EXPR, boolean_type_node, + cond = fold_binary (TRUTH_OR_EXPR, boolean_type_node, invert_truthvalue (niter_bound->additional), cond); |