Fix gimple_seq_nondebug_singleton_p

2015-06-09  Tom de Vries  <tom@codesourcery.com>

	* gimple-iterator.h (gimple_seq_nondebug_singleton_p): Don't
	always return false.

From-SVN: r224263
This commit is contained in:
Tom de Vries 2015-06-09 05:52:52 +00:00 committed by Tom de Vries
parent 7b337d2061
commit e92e61a7c2
2 changed files with 15 additions and 16 deletions

View File

@ -1,3 +1,8 @@
2015-06-09 Tom de Vries <tom@codesourcery.com>
* gimple-iterator.h (gimple_seq_nondebug_singleton_p): Don't
always return false.
2015-06-09 Alexandre Oliva <aoliva@redhat.com> 2015-06-09 Alexandre Oliva <aoliva@redhat.com>
PR rtl-optimization/64164 PR rtl-optimization/64164

View File

@ -351,33 +351,27 @@ static inline bool
gimple_seq_nondebug_singleton_p (gimple_seq seq) gimple_seq_nondebug_singleton_p (gimple_seq seq)
{ {
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
/* Find a nondebug gimple. */
gsi.ptr = gimple_seq_first (seq); gsi.ptr = gimple_seq_first (seq);
gsi.seq = &seq; gsi.seq = &seq;
gsi.bb = NULL; gsi.bb = NULL;
while (!gsi_end_p (gsi)
&& is_gimple_debug (gsi_stmt (gsi)))
gsi_next (&gsi);
/* Not a singleton if the sequence is empty. */ /* No nondebug gimple found, not a singleton. */
if (gsi_end_p (gsi)) if (gsi_end_p (gsi))
return false; return false;
/* Find a nondebug gimple. */ /* Find a next nondebug gimple. */
gsi_next (&gsi);
while (!gsi_end_p (gsi) while (!gsi_end_p (gsi)
&& is_gimple_debug (gsi_stmt (gsi))) && is_gimple_debug (gsi_stmt (gsi)))
gsi_next (&gsi); gsi_next (&gsi);
/* Not a nondebug singleton if there's no nondebug gimple. */ /* Only a singleton if there's no next nondebug gimple. */
if (is_gimple_debug (gsi_stmt (gsi))) return gsi_end_p (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 */ #endif /* GCC_GIMPLE_ITERATOR_H */