aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-ivopts.c
diff options
context:
space:
mode:
authorLawrence Crowl <crowl@google.com>2012-09-07 00:06:35 +0000
committerLawrence Crowl <crowl@gcc.gnu.org>2012-09-07 00:06:35 +0000
commit27bcd47cfab04b1b1e6d2712e34b9b289c7a2dd7 (patch)
tree82231821d6793cd33f15d6b9792a8b82f2ec15d1 /gcc/tree-ssa-loop-ivopts.c
parent316b938ed79ef024177ab82057a061a7a4b5af67 (diff)
downloadgcc-27bcd47cfab04b1b1e6d2712e34b9b289c7a2dd7.zip
gcc-27bcd47cfab04b1b1e6d2712e34b9b289c7a2dd7.tar.gz
gcc-27bcd47cfab04b1b1e6d2712e34b9b289c7a2dd7.tar.bz2
Modify gcc/*.[hc] double_int call sites to use the new interface.
This change entailed adding a few new methods to double_int. The change results in a 0.163% time improvement with a 70% confidence. Tested on x86_64. Index: gcc/ChangeLog 2012-09-06 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::operator &=): New. (double_int::operator ^=): New. (double_int::operator |=): New. (double_int::mul_with_sign): Modify overflow parameter to bool*. (double_int::add_with_sign): New. (double_int::ule): New. (double_int::sle): New. (binary double_int::operator *): Remove parameter name. (binary double_int::operator +): Likewise. (binary double_int::operator -): Likewise. (binary double_int::operator &): Likewise. (double_int::operator |): Likewise. (double_int::operator ^): Likewise. (double_int::and_not): Likewise. (double_int::from_shwi): Tidy formatting. (double_int::from_uhwi): Likewise. (double_int::from_uhwi): Likewise. * double-int.c (double_int::mul_with_sign): Modify overflow parameter to bool*. (double_int::add_with_sign): New. (double_int::ule): New. (double_int::sle): New. * builtins.c: Modify to use the new double_int interface. * cgraph.c: Likewise. * combine.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * gimple-fold.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimplify-rtx.c: Likewise. * ipa-prop.c: Likewise. * loop-iv.c: Likewise. * optabs.c: Likewise. * stor-layout.c: Likewise. * tree-affine.c: Likewise. * tree-cfg.c: Likewise. * tree-dfa.c: Likewise. * tree-flow-inline.h: Likewise. * tree-object-size.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-sccvn: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vrp.c: Likewise. * tree.h: Likewise. * tree.c: Likewise. * varasm.c: Likewise. From-SVN: r191047
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r--gcc/tree-ssa-loop-ivopts.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index c0a8252..74097f8 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -1571,8 +1571,7 @@ constant_multiple_of (tree top, tree bot, double_int *mul)
if (!constant_multiple_of (TREE_OPERAND (top, 0), bot, &res))
return false;
- *mul = double_int_sext (double_int_mul (res, tree_to_double_int (mby)),
- precision);
+ *mul = (res * tree_to_double_int (mby)).sext (precision);
return true;
case PLUS_EXPR:
@@ -1582,21 +1581,20 @@ constant_multiple_of (tree top, tree bot, double_int *mul)
return false;
if (code == MINUS_EXPR)
- p1 = double_int_neg (p1);
- *mul = double_int_sext (double_int_add (p0, p1), precision);
+ p1 = -p1;
+ *mul = (p0 + p1).sext (precision);
return true;
case INTEGER_CST:
if (TREE_CODE (bot) != INTEGER_CST)
return false;
- p0 = double_int_sext (tree_to_double_int (top), precision);
- p1 = double_int_sext (tree_to_double_int (bot), precision);
- if (double_int_zero_p (p1))
+ p0 = tree_to_double_int (top).sext (precision);
+ p1 = tree_to_double_int (bot).sext (precision);
+ if (p1.is_zero ())
return false;
- *mul = double_int_sext (double_int_sdivmod (p0, p1, FLOOR_DIV_EXPR, &res),
- precision);
- return double_int_zero_p (res);
+ *mul = p0.sdivmod (p1, FLOOR_DIV_EXPR, &res).sext (precision);
+ return res.is_zero ();
default:
return false;
@@ -3000,7 +2998,7 @@ get_computation_aff (struct loop *loop,
aff_combination_add (&cbase_aff, &cstep_aff);
}
- aff_combination_scale (&cbase_aff, double_int_neg (rat));
+ aff_combination_scale (&cbase_aff, -rat);
aff_combination_add (aff, &cbase_aff);
if (common_type != uutype)
aff_combination_convert (aff, uutype);
@@ -3777,7 +3775,7 @@ compare_aff_trees (aff_tree *aff1, aff_tree *aff2)
for (i = 0; i < aff1->n; i++)
{
- if (double_int_cmp (aff1->elts[i].coef, aff2->elts[i].coef, 0) != 0)
+ if (aff1->elts[i].coef != aff2->elts[i].coef)
return false;
if (!operand_equal_p (aff1->elts[i].val, aff2->elts[i].val, 0))
@@ -3904,7 +3902,7 @@ get_loop_invariant_expr_id (struct ivopts_data *data, tree ubase,
tree_to_aff_combination (ub, TREE_TYPE (ub), &ubase_aff);
tree_to_aff_combination (cb, TREE_TYPE (cb), &cbase_aff);
- aff_combination_scale (&cbase_aff, shwi_to_double_int (-1 * ratio));
+ aff_combination_scale (&cbase_aff, double_int::from_shwi (-1 * ratio));
aff_combination_add (&ubase_aff, &cbase_aff);
expr = aff_combination_to_tree (&ubase_aff);
return get_expr_id (data, expr);
@@ -3990,8 +3988,8 @@ get_computation_cost_at (struct ivopts_data *data,
if (!constant_multiple_of (ustep, cstep, &rat))
return infinite_cost;
- if (double_int_fits_in_shwi_p (rat))
- ratio = double_int_to_shwi (rat);
+ if (rat.fits_shwi ())
+ ratio = rat.to_shwi ();
else
return infinite_cost;
@@ -4504,7 +4502,7 @@ iv_elimination_compare_lt (struct ivopts_data *data,
aff_combination_scale (&tmpa, double_int_minus_one);
aff_combination_add (&tmpb, &tmpa);
aff_combination_add (&tmpb, &nit);
- if (tmpb.n != 0 || !double_int_equal_p (tmpb.offset, double_int_one))
+ if (tmpb.n != 0 || tmpb.offset != double_int_one)
return false;
/* Finally, check that CAND->IV->BASE - CAND->IV->STEP * A does not
@@ -4594,9 +4592,9 @@ may_eliminate_iv (struct ivopts_data *data,
max_niter = desc->max;
if (stmt_after_increment (loop, cand, use->stmt))
- max_niter = double_int_add (max_niter, double_int_one);
+ max_niter += double_int_one;
period_value = tree_to_double_int (period);
- if (double_int_ucmp (max_niter, period_value) > 0)
+ if (max_niter.ugt (period_value))
{
/* See if we can take advantage of inferred loop bound information. */
if (data->loop_single_exit_p)
@@ -4604,7 +4602,7 @@ may_eliminate_iv (struct ivopts_data *data,
if (!max_loop_iterations (loop, &max_niter))
return false;
/* The loop bound is already adjusted by adding 1. */
- if (double_int_ucmp (max_niter, period_value) > 0)
+ if (max_niter.ugt (period_value))
return false;
}
else