public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] tree-optimization/102183 - sccvn: fix result compare in vn_nary_op_insert_into
@ 2021-09-06  2:48 Di Zhao OS
  2021-09-06  7:33 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Di Zhao OS @ 2021-09-06  2:48 UTC (permalink / raw)
  To: gcc-patches

If the first predicate value is different and copied, the comparison will then be between val->result and the copied one, which seems to be a bug. That can cause inserting extra vn_pvals.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

Regards,
Di Zhao

gcc/ChangeLog:

	* tree-ssa-sccvn.c (vn_nary_op_insert_into): fix result compare
---
 gcc/tree-ssa-sccvn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 2357bbdbf90..bfa516b6cf9 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -4105,7 +4105,7 @@ vn_nary_op_insert_into (vn_nary_op_t vno, vn_nary_op_table_type *table,
 	  bool found = false;
 	  for (vn_pval *val = (*slot)->u.values; val; val = val->next)
 	    {
-	      if (expressions_equal_p (val->result, vno->u.values->result))
+	      if (expressions_equal_p (val->result, nval->result))
 		{
 		  found = true;
 		  for (unsigned i = 0; i < val->n; ++i)
-- 
2.25.1




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

* Re: [PATCH] tree-optimization/102183 - sccvn: fix result compare in vn_nary_op_insert_into
  2021-09-06  2:48 [PATCH] tree-optimization/102183 - sccvn: fix result compare in vn_nary_op_insert_into Di Zhao OS
@ 2021-09-06  7:33 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2021-09-06  7:33 UTC (permalink / raw)
  To: Di Zhao OS; +Cc: gcc-patches

On Mon, Sep 6, 2021 at 4:48 AM Di Zhao OS <dizhao@os.amperecomputing.com> wrote:
>
> If the first predicate value is different and copied, the comparison will then be between val->result and the copied one, which seems to be a bug. That can cause inserting extra vn_pvals.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu.

OK.

Thanks,
Richard.

> Regards,
> Di Zhao
>
> gcc/ChangeLog:
>
>         * tree-ssa-sccvn.c (vn_nary_op_insert_into): fix result compare
> ---
>  gcc/tree-ssa-sccvn.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
> index 2357bbdbf90..bfa516b6cf9 100644
> --- a/gcc/tree-ssa-sccvn.c
> +++ b/gcc/tree-ssa-sccvn.c
> @@ -4105,7 +4105,7 @@ vn_nary_op_insert_into (vn_nary_op_t vno, vn_nary_op_table_type *table,
>           bool found = false;
>           for (vn_pval *val = (*slot)->u.values; val; val = val->next)
>             {
> -             if (expressions_equal_p (val->result, vno->u.values->result))
> +             if (expressions_equal_p (val->result, nval->result))
>                 {
>                   found = true;
>                   for (unsigned i = 0; i < val->n; ++i)
> --
> 2.25.1
>
>
>

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

end of thread, other threads:[~2021-09-06  7:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06  2:48 [PATCH] tree-optimization/102183 - sccvn: fix result compare in vn_nary_op_insert_into Di Zhao OS
2021-09-06  7:33 ` 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).