aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-06-01 07:56:34 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-06-01 07:56:34 +0000
commit44eff886de1ade42076ad8168f76a28886fdeaa8 (patch)
tree3085a65351ee0a2b9037e2d812df776ea9aadd7e /gcc
parented98eed866d587f64cb43967de50adc107597cc5 (diff)
downloadgcc-44eff886de1ade42076ad8168f76a28886fdeaa8.zip
gcc-44eff886de1ade42076ad8168f76a28886fdeaa8.tar.gz
gcc-44eff886de1ade42076ad8168f76a28886fdeaa8.tar.bz2
tree-ssa-reassoc.c (get_rank): Simplify.
2015-06-01 Richard Biener <rguenther@suse.de> * tree-ssa-reassoc.c (get_rank): Simplify. From-SVN: r223914
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/tree-ssa-reassoc.c43
2 files changed, 12 insertions, 35 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0394d19..22af4a9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2015-06-01 Richard Biener <rguenther@suse.de>
+
+ * tree-ssa-reassoc.c (get_rank): Simplify.
+
2015-05-31 H.J. Lu <hongjiu.lu@intel.com>
* configure.ac (NO_PIE_CFLAGS): Check CXXFLAGS instead of CFLAGS.
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 0c67379..8a64511 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -417,10 +417,6 @@ insert_operand_rank (tree e, long rank)
static long
get_rank (tree e)
{
- /* Constants have rank 0. */
- if (is_gimple_min_invariant (e))
- return 0;
-
/* SSA_NAME's have the rank of the expression they are the result
of.
For globals and uninitialized values, the rank is 0.
@@ -460,9 +456,9 @@ get_rank (tree e)
if (TREE_CODE (e) == SSA_NAME)
{
+ ssa_op_iter iter;
gimple stmt;
long rank;
- int i, n;
tree op;
if (SSA_NAME_IS_DEFAULT_DEF (e))
@@ -472,8 +468,7 @@ get_rank (tree e)
if (gimple_code (stmt) == GIMPLE_PHI)
return phi_rank (stmt);
- if (!is_gimple_assign (stmt)
- || gimple_vdef (stmt))
+ if (!is_gimple_assign (stmt))
return bb_rank[gimple_bb (stmt)->index];
/* If we already have a rank for this expression, use that. */
@@ -484,34 +479,12 @@ get_rank (tree e)
/* Otherwise, find the maximum rank for the operands. As an
exception, remove the bias from loop-carried phis when propagating
the rank so that dependent operations are not also biased. */
+ /* Simply walk over all SSA uses - this takes advatage of the
+ fact that non-SSA operands are is_gimple_min_invariant and
+ thus have rank 0. */
rank = 0;
- if (gimple_assign_single_p (stmt))
- {
- tree rhs = gimple_assign_rhs1 (stmt);
- n = TREE_OPERAND_LENGTH (rhs);
- if (n == 0)
- rank = propagate_rank (rank, rhs);
- else
- {
- for (i = 0; i < n; i++)
- {
- op = TREE_OPERAND (rhs, i);
-
- if (op != NULL_TREE)
- rank = propagate_rank (rank, op);
- }
- }
- }
- else
- {
- n = gimple_num_ops (stmt);
- for (i = 1; i < n; i++)
- {
- op = gimple_op (stmt, i);
- gcc_assert (op);
- rank = propagate_rank (rank, op);
- }
- }
+ FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
+ rank = propagate_rank (rank, op);
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -525,7 +498,7 @@ get_rank (tree e)
return (rank + 1);
}
- /* Globals, etc, are rank 0 */
+ /* Constants, globals, etc., are rank 0 */
return 0;
}