aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-copy.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-copy.c')
-rw-r--r--gcc/tree-ssa-copy.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index e0ed63f..1d404d2 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -45,6 +45,8 @@ along with GCC; see the file COPYING3. If not see
#include "cfgloop.h"
#include "tree-scalar-evolution.h"
#include "tree-ssa-dom.h"
+#include "tree-ssa-loop-niter.h"
+
/* This file implements the copy propagation pass and provides a
handful of interfaces for performing const/copy propagation and
@@ -542,7 +544,7 @@ get_value (tree name)
/* Deallocate memory used in copy propagation and do final
substitution. */
-static void
+static bool
fini_copy_prop (void)
{
unsigned i;
@@ -594,10 +596,17 @@ fini_copy_prop (void)
}
}
- /* Don't do DCE if SCEV is initialized. It would destroy the scev cache. */
- substitute_and_fold (get_value, NULL, !scev_initialized_p ());
+ bool changed = substitute_and_fold (get_value, NULL, true);
+ if (changed)
+ {
+ free_numbers_of_iterations_estimates ();
+ if (scev_initialized_p ())
+ scev_reset ();
+ }
free (copy_of);
+
+ return changed;
}
@@ -639,7 +648,8 @@ execute_copy_prop (void)
{
init_copy_prop ();
ssa_propagate (copy_prop_visit_stmt, copy_prop_visit_phi_node);
- fini_copy_prop ();
+ if (fini_copy_prop ())
+ return TODO_cleanup_cfg;
return 0;
}
@@ -656,7 +666,7 @@ const pass_data pass_data_copy_prop =
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
- ( TODO_cleanup_cfg | TODO_update_ssa ), /* todo_flags_finish */
+ 0, /* todo_flags_finish */
};
class pass_copy_prop : public gimple_opt_pass