public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Tom de Vries <Tom_deVries@mentor.com>
Cc: "gcc-patches@gnu.org" <gcc-patches@gnu.org>
Subject: Re: [PATCH] Fix parloops gimple_uid usage
Date: Mon, 12 Oct 2015 10:04:00 -0000	[thread overview]
Message-ID: <CAFiYyc078vFmEMiy0wykV4n7aarVCqD3+rcj2SYAdsbHyEN5=g@mail.gmail.com> (raw)
In-Reply-To: <56182D1D.2060106@mentor.com>

On Fri, Oct 9, 2015 at 11:09 PM, Tom de Vries <Tom_deVries@mentor.com> wrote:
> Hi,
>
> In tree-parloops.c:gather_scalar_reductions, we find the comment:
> ...
>   /* As gimple_uid is used by the vectorizer in between
>      vect_analyze_loop_form and destroy_loop_vec_info, we can set
>      gimple_uid of reduc_phi stmts only now.  */
>   reduction_list->traverse <void *, set_reduc_phi_uids> (NULL);
> ...
>
> However, the usage of gimple_uid seems to extend until the
> free_stmt_vec_info_vec call at the end of parallelize_loops (the pass
> top-level function). During free_stmt_vec_info_vec we test for gimple_uid ==
> 0 in vinfo_for_stmt.
>
> By initializing all the phis in the function with -1 before using them in
> the reduct_phi stmts:
> ...
>    destroy_loop_vec_info (simple_loop_info, true);
>    destroy_loop_vec_info (simple_inner_loop_info, true);
>
>
>
>    /* As gimple_uid is used by the vectorizer in between
>       vect_analyze_loop_form and destroy_loop_vec_info, we can set
>       gimple_uid of reduc_phi stmts only now. */
> +  basic_block bb;
> +  FOR_EACH_BB_FN (bb, cfun)
> +    for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
> +      gimple_set_uid (gsi_stmt (gsi), (unsigned int)-1);
>  reduction_list->traverse <void *, set_reduc_phi_uids> (NULL);
> ...
> we trigger a sigsegv in vinfo_for_stmt while trying to access
> stmt_vec_info_vec[4294967295 - 1].
>
> This patch fixes that by moving the calls to init_stmt_vec_info_vec and
> free_stmt_vec_info_vec from parallelize_loops and gather_scalar_reductions.
>
> Furthermore, now that the gimple_uids are properly initialized, we can in
> reduction_phi:
> - handle 0 (new phi) and -1 (initialized) values, both meaning the
>   phi's not in the table, and
> - assert that returned entries in fact match the phi argument.
>
> OK for trunk if bootstrap and reg-test passes?

Ok.

Richard.

> Thanks,
> - Tom
>

  reply	other threads:[~2015-10-12 10:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09 21:11 Tom de Vries
2015-10-12 10:04 ` Richard Biener [this message]
2015-11-20 15:57 ` [PATCH, PR68460] Always call free_stmt_vec_info_vec in gather_scalar_reductions Tom de Vries
2015-11-23  9:43   ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFiYyc078vFmEMiy0wykV4n7aarVCqD3+rcj2SYAdsbHyEN5=g@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=Tom_deVries@mentor.com \
    --cc=gcc-patches@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).