summaryrefslogtreecommitdiff
path: root/gcc/tree-scalar-evolution.c
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-30 21:18:38 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-30 21:18:38 +0000
commita05095f9a5d298af2e6cb5353a7d32681f985d26 (patch)
treed40aaf45844c05a0f308914499d089d6a8955b40 /gcc/tree-scalar-evolution.c
parentbef5a5f54eaf24fa1b0c88d61c56dbcfbc726332 (diff)
downloadgcc-a05095f9a5d298af2e6cb5353a7d32681f985d26.tar.gz
Fix chrec_contains_symbols_defined_in_loop.
2010-08-20 Sebastian Pop <sebastian.pop@amd.com> * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Do not check for VAR_DECL, PARM_DECL, FUNCTION_DECL, LABEL_DECL, RESULT_DECL, and FIELD_DECL. Return false for an SSA_NAME_IS_DEFAULT_DEF. (compute_scalar_evolution_in_loop): Do not further analyze the scalar evolution when no_evolution_in_loop_p returns true. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164789 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-scalar-evolution.c')
-rw-r--r--gcc/tree-scalar-evolution.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index c7f45f229d1..a7e165aed3f 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -385,19 +385,17 @@ chrec_contains_symbols_defined_in_loop (const_tree chrec, unsigned loop_nb)
if (is_gimple_min_invariant (chrec))
return false;
- if (TREE_CODE (chrec) == VAR_DECL
- || TREE_CODE (chrec) == PARM_DECL
- || TREE_CODE (chrec) == FUNCTION_DECL
- || TREE_CODE (chrec) == LABEL_DECL
- || TREE_CODE (chrec) == RESULT_DECL
- || TREE_CODE (chrec) == FIELD_DECL)
- return true;
-
if (TREE_CODE (chrec) == SSA_NAME)
{
- gimple def = SSA_NAME_DEF_STMT (chrec);
- struct loop *def_loop = loop_containing_stmt (def);
- struct loop *loop = get_loop (loop_nb);
+ gimple def;
+ loop_p def_loop, loop;
+
+ if (SSA_NAME_IS_DEFAULT_DEF (chrec))
+ return false;
+
+ def = SSA_NAME_DEF_STMT (chrec);
+ def_loop = loop_containing_stmt (def);
+ loop = get_loop (loop_nb);
if (def_loop == NULL)
return false;
@@ -1834,13 +1832,18 @@ compute_scalar_evolution_in_loop (struct loop *wrto_loop,
struct loop *def_loop,
tree ev)
{
+ bool val;
tree res;
+
if (def_loop == wrto_loop)
return ev;
def_loop = superloop_at_depth (def_loop, loop_depth (wrto_loop) + 1);
res = compute_overall_effect_of_inner_loop (def_loop, ev);
+ if (no_evolution_in_loop_p (res, wrto_loop->num, &val) && val)
+ return res;
+
return analyze_scalar_evolution_1 (wrto_loop, res, chrec_not_analyzed_yet);
}