aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-iterator.h
diff options
context:
space:
mode:
authorTom de Vries <tom@codesourcery.com>2015-06-08 11:53:27 +0000
committerTom de Vries <vries@gcc.gnu.org>2015-06-08 11:53:27 +0000
commit1b7f61ebc8920326b5dc30f79cfc86ef0cb7bb28 (patch)
tree05a269611c4afd372c2778b7d951d8232bea1c84 /gcc/gimple-iterator.h
parentaa4e0c43bc9db9ae1411e4957720b887fe5e1edf (diff)
downloadgcc-1b7f61ebc8920326b5dc30f79cfc86ef0cb7bb28.zip
gcc-1b7f61ebc8920326b5dc30f79cfc86ef0cb7bb28.tar.gz
gcc-1b7f61ebc8920326b5dc30f79cfc86ef0cb7bb28.tar.bz2
Fix try_transform_to_exit_first_loop_alt
2015-06-08 Tom de Vries <tom@codesourcery.com> PR tree-optimization/66442 * gimple-iterator.h (gimple_seq_nondebug_singleton_p): Add function. * tree-parloops.c (try_transform_to_exit_first_loop_alt): Return false if the loop latch is not a singleton. Use gimple_seq_nondebug_singleton_p instead of gimple_seq_singleton_p. From-SVN: r224218
Diffstat (limited to 'gcc/gimple-iterator.h')
-rw-r--r--gcc/gimple-iterator.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/gimple-iterator.h b/gcc/gimple-iterator.h
index 87e943a..d08245e 100644
--- a/gcc/gimple-iterator.h
+++ b/gcc/gimple-iterator.h
@@ -345,4 +345,39 @@ gsi_seq (gimple_stmt_iterator i)
return *i.seq;
}
+/* Determine whether SEQ is a nondebug singleton. */
+
+static inline bool
+gimple_seq_nondebug_singleton_p (gimple_seq seq)
+{
+ gimple_stmt_iterator gsi;
+ gsi.ptr = gimple_seq_first (seq);
+ gsi.seq = &seq;
+ gsi.bb = NULL;
+
+ /* Not a singleton if the sequence is empty. */
+ if (gsi_end_p (gsi))
+ return false;
+
+ /* Find a nondebug gimple. */
+ while (!gsi_end_p (gsi)
+ && is_gimple_debug (gsi_stmt (gsi)))
+ gsi_next (&gsi);
+
+ /* Not a nondebug singleton if there's no nondebug gimple. */
+ if (is_gimple_debug (gsi_stmt (gsi)))
+ return false;
+
+ /* Find the next nondebug gimple. */
+ while (!gsi_end_p (gsi)
+ && is_gimple_debug (gsi_stmt (gsi)))
+ gsi_next (&gsi);
+
+ /* If there's a next nondebug gimple, it's not a nondebug singleton. */
+ if (!gsi_end_p (gsi))
+ return false;
+
+ return true;
+}
+
#endif /* GCC_GIMPLE_ITERATOR_H */