tree-optimization/102183 - sccvn: fix result compare in vn_nary_op_insert_into
authorDi Zhao <dizhao@os.amperecomputing.com>
Wed, 8 Sep 2021 07:34:27 +0000 (15:34 +0800)
committerDi Zhao <dizhao@os.amperecomputing.com>
Wed, 8 Sep 2021 10:47:18 +0000 (18:47 +0800)
If the first predicate value is different and copied, the comparison will then
be between val->result and the copied one. That can cause inserting extra
vn_pvals.

gcc/ChangeLog:

* tree-ssa-sccvn.c (vn_nary_op_insert_into): fix result compare

gcc/tree-ssa-sccvn.c

index 2357bbd..bfa516b 100644 (file)
@@ -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)