public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Add missing check for gassign.
@ 2020-06-18  7:42 Martin Liška
  2020-06-18  8:05 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Liška @ 2020-06-18  7:42 UTC (permalink / raw)
  To: gcc-patches

Hi.

We should check for gassign before doing gimple_assign_rhs_code and friends.

Ready to be installed after proper testing?

Thanks,
Martin

gcc/ChangeLog:

	* tree-vect-generic.c (expand_vector_condition): Check
	for gassign before inspecting RHS.
---
  gcc/tree-vect-generic.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index fb955bbf3d2..83d399a7898 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -957,8 +957,9 @@ expand_vector_condition (gimple_stmt_iterator *gsi)
  
    if (code == SSA_NAME)
      {
-      gimple *assign = SSA_NAME_DEF_STMT (a);
-      if (TREE_CODE_CLASS (gimple_assign_rhs_code (assign)) == tcc_comparison)
+      gassign *assign = dyn_cast<gassign *> (SSA_NAME_DEF_STMT (a));
+      if (assign != NULL
+	  && TREE_CODE_CLASS (gimple_assign_rhs_code (assign)) == tcc_comparison)
  	{
  	  a_is_comparison = true;
  	  a1 = gimple_assign_rhs1 (assign);
-- 
2.27.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Add missing check for gassign.
  2020-06-18  7:42 [PATCH] Add missing check for gassign Martin Liška
@ 2020-06-18  8:05 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2020-06-18  8:05 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Thu, Jun 18, 2020 at 9:42 AM Martin Liška <mliska@suse.cz> wrote:
>
> Hi.
>
> We should check for gassign before doing gimple_assign_rhs_code and friends.
>
> Ready to be installed after proper testing?

OK.

> Thanks,
> Martin
>
> gcc/ChangeLog:
>
>         * tree-vect-generic.c (expand_vector_condition): Check
>         for gassign before inspecting RHS.
> ---
>   gcc/tree-vect-generic.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
> index fb955bbf3d2..83d399a7898 100644
> --- a/gcc/tree-vect-generic.c
> +++ b/gcc/tree-vect-generic.c
> @@ -957,8 +957,9 @@ expand_vector_condition (gimple_stmt_iterator *gsi)
>
>     if (code == SSA_NAME)
>       {
> -      gimple *assign = SSA_NAME_DEF_STMT (a);
> -      if (TREE_CODE_CLASS (gimple_assign_rhs_code (assign)) == tcc_comparison)
> +      gassign *assign = dyn_cast<gassign *> (SSA_NAME_DEF_STMT (a));
> +      if (assign != NULL
> +         && TREE_CODE_CLASS (gimple_assign_rhs_code (assign)) == tcc_comparison)
>         {
>           a_is_comparison = true;
>           a1 = gimple_assign_rhs1 (assign);
> --
> 2.27.0
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-18  8:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18  7:42 [PATCH] Add missing check for gassign Martin Liška
2020-06-18  8:05 ` Richard Biener

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).