summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-24 14:47:55 +0000
committervries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-24 14:47:55 +0000
commitb11dc37dbec1d99e967a76da89c2bd3c446346dc (patch)
tree0367b380138fae228e11618b71da358fba49e479
parent33a9b5cd9530dab39fbf99559fb2a9c9aadc8bb5 (diff)
downloadgcc-b11dc37dbec1d99e967a76da89c2bd3c446346dc.tar.gz
Allow pass_lim to run outside pass_tree_loop
2015-11-24 Tom de Vries <tom@codesourcery.com> * tree-ssa-loop-im.c (tree_ssa_lim): Make static. (pass_lim::execute): Allow to run outside pass_tree_loop. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230815 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-ssa-loop-im.c12
2 files changed, 15 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6a5ebdeeed8..5d185344932 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-24 Tom de Vries <tom@codesourcery.com>
+
+ * tree-ssa-loop-im.c (tree_ssa_lim): Make static.
+ (pass_lim::execute): Allow to run outside pass_tree_loop.
+
2015-11-24 Wilco Dijkstra <wdijkstr@arm.com>
* gcc/config/aarch64/aarch64.md (add<mode>3):
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 30b53ce1989..0d82d36af93 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-propagate.h"
#include "trans-mem.h"
#include "gimple-fold.h"
+#include "tree-scalar-evolution.h"
/* TODO: Support for predicated code motion. I.e.
@@ -2496,7 +2497,7 @@ tree_ssa_lim_finalize (void)
/* Moves invariants from loops. Only "expensive" invariants are moved out --
i.e. those that are likely to be win regardless of the register pressure. */
-unsigned int
+static unsigned int
tree_ssa_lim (void)
{
unsigned int todo;
@@ -2560,10 +2561,17 @@ public:
unsigned int
pass_lim::execute (function *fun)
{
+ bool in_loop_pipeline = scev_initialized_p ();
+ if (!in_loop_pipeline)
+ loop_optimizer_init (LOOPS_NORMAL | LOOPS_HAVE_RECORDED_EXITS);
+
if (number_of_loops (fun) <= 1)
return 0;
+ unsigned int todo = tree_ssa_lim ();
- return tree_ssa_lim ();
+ if (!in_loop_pipeline)
+ loop_optimizer_finalize ();
+ return todo;
}
} // anon namespace