Martin Liška <mli...@suse.cz> writes:
> Hello.
>
> I'm working one extension of SLP which will allow to vectorize multiple
> BBs. This is a first step where I abstract _bb_vec_info::region_begin and
> _bb_vec_info::region end by providing an iterator.

Nice.

> diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
> index 6c830ad09f4..542d49402d2 100644
> --- a/gcc/tree-vectorizer.h
> +++ b/gcc/tree-vectorizer.h
> @@ -787,12 +787,46 @@ loop_vec_info_for_loop (class loop *loop)
>   typedef class _bb_vec_info : public vec_info
>   {
>   public:
> +  struct const_iterator
> +  {
> +    const_iterator (gimple_stmt_iterator _gsi): gsi (_gsi)
> +    {
> +    }
> +
> +    const_iterator &
> +    operator++ (int)
> +    {
> +      gsi_next (&gsi); return *this;
> +    }

Isn't this really operator++()?  I.e. it returns a reference to the
modified iterator instead of the value at the original iterator.

With that change, is there any reason we can't use a range-based for
loop instead of:

  for (_bb_vec_info::const_iterator it = begin (); it != end (); it++)

etc.?

Thanks,
Richard

Reply via email to