summaryrefslogtreecommitdiff
path: root/gcc/ipa-pure-const.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-05 17:02:26 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-05 17:02:26 +0000
commit4c170941ee7ac668687d0df2b619be6fc9646c62 (patch)
treeacef4131d9a1dae649c2564c544c7027da6300d5 /gcc/ipa-pure-const.c
parentd6bff3e6520fc0288a2c6348b9c64c4b3df3cb92 (diff)
downloadgcc-4c170941ee7ac668687d0df2b619be6fc9646c62.tar.gz
* ipa-pure-const.c (propagate): Fix type in handling functions
that can not return; be more cureful about merging the results with previously known. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160321 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-pure-const.c')
-rw-r--r--gcc/ipa-pure-const.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index d785389191a..299019a145c 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -1055,7 +1055,7 @@ propagate (void)
pure_const_names[y_l->pure_const_state],
y_l->looping);
}
- if (y_l->pure_const_state > ECF_PURE
+ if (y_l->pure_const_state > IPA_PURE
&& cgraph_edge_cannot_lead_to_return (e))
{
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -1108,10 +1108,17 @@ propagate (void)
edge_looping = true;
}
}
+
+ /* Merge the results with what we already know.
+ When we found function to be NEITHER, but we know
+ it is looping pure const, be sure to set the looping flag. */
pure_const_state = MAX (pure_const_state, MIN (edge_state,
w_l->state_previously_known));
- looping = MAX (looping, MIN (edge_looping,
- w_l->looping_previously_known));
+ if (edge_state > w_l->state_previously_known)
+ looping = MAX (looping, w_l->looping_previously_known);
+ else
+ looping = MAX (looping, MIN (edge_looping,
+ w_l->looping_previously_known));
if (pure_const_state == IPA_NEITHER)
break;
}
@@ -1134,7 +1141,10 @@ propagate (void)
if (w_l->state_previously_known != IPA_NEITHER
&& this_state > w_l->state_previously_known)
- this_state = w_l->state_previously_known;
+ {
+ this_state = w_l->state_previously_known;
+ this_looping |= w_l->looping_previously_known;
+ }
if (!this_looping && self_recursive_p (w))
this_looping = true;
if (!w_l->looping_previously_known)