summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-26 14:35:27 +0000
committervries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-26 14:35:27 +0000
commitfcc862017f5608aefaf796050ead55d36b5bd00b (patch)
tree68daccaf06f934ff44ab4baa4d808aedebcc54ec
parent82c27d0f8762ae839fc9db911e4a08d5774ca843 (diff)
downloadgcc-fcc862017f5608aefaf796050ead55d36b5bd00b.tar.gz
Revert "Improve verification of loop->latch in verify_loop_structure"
2015-11-26 Tom de Vries <tom@codesourcery.com> revert: 2015-11-25 Tom de Vries <tom@codesourcery.com> * cfgloop.c (find_single_latch): New function, factored out of ... (flow_loops_find): ... here. (verify_loop_structure): Improve verification of loop->latch. * cfgloop.h (find_single_latch): Declare. * omp-low.c (expand_omp_for_generic): Initialize latch of orig_loop. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230967 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/cfgloop.c70
-rw-r--r--gcc/cfgloop.h1
-rw-r--r--gcc/omp-low.c1
4 files changed, 31 insertions, 52 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8609f0dcdaf..da80e714099 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2015-11-26 Tom de Vries <tom@codesourcery.com>
+
+ revert:
+ 2015-11-25 Tom de Vries <tom@codesourcery.com>
+
+ * cfgloop.c (find_single_latch): New function, factored out of ...
+ (flow_loops_find): ... here.
+ (verify_loop_structure): Improve verification of loop->latch.
+ * cfgloop.h (find_single_latch): Declare.
+ * omp-low.c (expand_omp_for_generic): Initialize latch of orig_loop.
+
2015-11-26 Matthew Wahab <matthew.wahab@arm.com>
* config/aarch64/aarch64-simd-builtins.def:
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index e7cb78a5351..83a526276db 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -388,33 +388,6 @@ bb_loop_header_p (basic_block header)
return false;
}
-/* Return the latch block for this header block, if it has just a single one.
- Otherwise, return NULL. */
-
-basic_block
-find_single_latch (struct loop* loop)
-{
- basic_block header = loop->header;
- edge_iterator ei;
- edge e;
- basic_block latch = NULL;
-
- FOR_EACH_EDGE (e, ei, header->preds)
- {
- basic_block cand = e->src;
- if (!flow_bb_inside_loop_p (loop, cand))
- continue;
-
- if (latch != NULL)
- /* More than one latch edge. */
- return NULL;
-
- latch = cand;
- }
-
- return latch;
-}
-
/* Find all the natural loops in the function and save in LOOPS structure and
recalculate loop_father information in basic block structures.
If LOOPS is non-NULL then the loop structures for already recorded loops
@@ -509,10 +482,29 @@ flow_loops_find (struct loops *loops)
{
struct loop *loop = larray[i];
basic_block header = loop->header;
+ edge_iterator ei;
+ edge e;
flow_loop_tree_node_add (header->loop_father, loop);
loop->num_nodes = flow_loop_nodes_find (loop->header, loop);
- loop->latch = find_single_latch (loop);
+
+ /* Look for the latch for this header block, if it has just a
+ single one. */
+ FOR_EACH_EDGE (e, ei, header->preds)
+ {
+ basic_block latch = e->src;
+
+ if (flow_bb_inside_loop_p (loop, latch))
+ {
+ if (loop->latch != NULL)
+ {
+ /* More than one latch edge. */
+ loop->latch = NULL;
+ break;
+ }
+ loop->latch = latch;
+ }
+ }
}
return loops;
@@ -1442,28 +1434,6 @@ verify_loop_structure (void)
error ("loop %d%'s latch is not dominated by its header", i);
err = 1;
}
- if (find_single_latch (loop) == NULL)
- {
- error ("loop %d%'s latch is is not the only latch", i);
- err = 1;
- }
- }
- else
- {
- if (loops_state_satisfies_p (LOOPS_MAY_HAVE_MULTIPLE_LATCHES))
- {
- if (find_single_latch (loop) != NULL)
- {
- error ("loop %d%'s latch is missing", i);
- err = 1;
- }
- }
- else
- {
- error ("loop %d%'s latch is missing, and loops may not have"
- " multiple latches", i);
- err = 1;
- }
}
if (loops_state_satisfies_p (LOOPS_HAVE_SIMPLE_LATCHES))
{
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index 7faf591796f..ee73bf994c1 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -270,7 +270,6 @@ bool mark_irreducible_loops (void);
void release_recorded_exits (function *);
void record_loop_exits (void);
void rescan_loop_exit (edge, bool, bool);
-basic_block find_single_latch (struct loop*);
/* Loop data structure manipulation/querying. */
extern void flow_loop_tree_node_add (struct loop *, struct loop *);
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 0b44588b5a1..f17a828330a 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -8907,7 +8907,6 @@ expand_omp_for_generic (struct omp_region *region,
orig_loop->header = l1_bb;
/* The loop may have multiple latches. */
add_loop (orig_loop, new_loop);
- orig_loop->latch = find_single_latch (orig_loop);
}
}
}