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