From: Di Zhao OS <dizhao@os.amperecomputing.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [PATCH] tree-optimization/102183 - sccvn: fix result compare in vn_nary_op_insert_into
Date: Mon, 6 Sep 2021 02:48:17 +0000 [thread overview]
Message-ID: <SN6PR01MB42405C16083761ADD68092B2E8D29@SN6PR01MB4240.prod.exchangelabs.com> (raw)
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
next reply other threads:[~2021-09-06 2:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-06 2:48 Di Zhao OS [this message]
2021-09-06 7:33 ` 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=SN6PR01MB42405C16083761ADD68092B2E8D29@SN6PR01MB4240.prod.exchangelabs.com \
--to=dizhao@os.amperecomputing.com \
--cc=gcc-patches@gcc.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).