aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2012-10-17 21:50:16 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2012-10-17 19:50:16 +0000
commitbf45c4c0c13c77791f8ec5325706baef32ce6644 (patch)
tree0946728541035742ddd41dc817f634a847ab85d2 /gcc
parentb7442c2fe0e28b96f0789d41132849b7c99402d4 (diff)
downloadgcc-bf45c4c0c13c77791f8ec5325706baef32ce6644.zip
gcc-bf45c4c0c13c77791f8ec5325706baef32ce6644.tar.gz
gcc-bf45c4c0c13c77791f8ec5325706baef32ce6644.tar.bz2
cfgloopmanip.c (copy_loop_info): New function.
* cfgloopmanip.c (copy_loop_info): New function. (duplicate_loop): Use it. (loop_version): Use it. * loop-unswitch.c (unswitch_loop): Use it. * cfgloop.h (copy_loop_info): Declare. From-SVN: r192543
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/cfgloop.h1
-rw-r--r--gcc/cfgloopmanip.c18
-rw-r--r--gcc/loop-unswitch.c1
4 files changed, 28 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 63635b8..b5cde03 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2012-10-17 Jan Hubicka <jh@suse.cz>
+ * cfgloopmanip.c (copy_loop_info): New function.
+ (duplicate_loop): Use it.
+ (loop_version): Use it.
+ * loop-unswitch.c (unswitch_loop): Use it.
+ * cfgloop.h (copy_loop_info): Declare.
+
+2012-10-17 Jan Hubicka <jh@suse.cz>
+
* tree-ssa-loop-ivcanon.c (tree_estimate_loop_size): Add edge_to_cancel
parameter and use it to estimate code optimized out in the final iteration.
(loop_edge_to_cancel): New function.
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index 9766066..a485504 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -310,6 +310,7 @@ extern edge create_empty_if_region_on_edge (edge, tree);
extern struct loop *create_empty_loop_on_edge (edge, tree, tree, tree, tree,
tree *, tree *, struct loop *);
extern struct loop * duplicate_loop (struct loop *, struct loop *);
+extern void copy_loop_info (struct loop *loop, struct loop *target);
extern void duplicate_subloops (struct loop *, struct loop *);
extern bool duplicate_loop_to_header_edge (struct loop *, edge,
unsigned, sbitmap, edge,
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 98f359e..97a90bb 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -970,6 +970,20 @@ fix_loop_placements (struct loop *loop, bool *irred_invalidated)
}
}
+/* Duplicate loop bounds and other information we store about
+ the loop into its duplicate. */
+
+void
+copy_loop_info (struct loop *loop, struct loop *target)
+{
+ gcc_checking_assert (!target->any_upper_bound && !target->any_estimate);
+ target->any_upper_bound = loop->any_upper_bound;
+ target->nb_iterations_upper_bound = loop->nb_iterations_upper_bound;
+ target->any_estimate = loop->any_estimate;
+ target->nb_iterations_estimate = loop->nb_iterations_estimate;
+ target->estimate_state = loop->estimate_state;
+}
+
/* Copies copy of LOOP as subloop of TARGET loop, placing newly
created loop into loops structure. */
struct loop *
@@ -978,6 +992,8 @@ duplicate_loop (struct loop *loop, struct loop *target)
struct loop *cloop;
cloop = alloc_loop ();
place_new_loop (cloop);
+
+ copy_loop_info (loop, cloop);
/* Mark the new loop as copy of LOOP. */
set_loop_copy (loop, cloop);
@@ -1686,6 +1702,8 @@ loop_version (struct loop *loop,
false /* Do not redirect all edges. */,
then_scale, else_scale);
+ copy_loop_info (loop, nloop);
+
/* loopify redirected latch_edge. Update its PENDING_STMTS. */
lv_flush_pending_stmts (latch_edge);
diff --git a/gcc/loop-unswitch.c b/gcc/loop-unswitch.c
index 4107048..25d77da 100644
--- a/gcc/loop-unswitch.c
+++ b/gcc/loop-unswitch.c
@@ -454,6 +454,7 @@ unswitch_loop (struct loop *loop, basic_block unswitch_on, rtx cond, rtx cinsn)
BRANCH_EDGE (switch_bb), FALLTHRU_EDGE (switch_bb), true,
prob, REG_BR_PROB_BASE - prob);
+ copy_loop_info (loop, nloop);
/* Remove branches that are now unreachable in new loops. */
remove_path (true_edge);
remove_path (false_edge);