https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80620

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Now needs sth before r247596 to reproduce.

The whole

            PRE_EXPR_NARY (expr) = newnary;
            constant = fully_constant_expression (expr);
            PRE_EXPR_NARY (expr) = nary;
            if (constant != expr)
              {
                /* For non-CONSTANTs we have to make sure we can eventually
                   insert the expression.  Which means we need to have a
                   leader for it.  */
                if (constant->kind != CONSTANT)
                  {
                    /* Do not allow simplifications to non-constants over
                       backedges as this will likely result in a loop PHI node
                       to be inserted and increased register pressure.
                       See PR77498 - this avoids doing predcoms work in
                       a less efficient way.  */
                    if (find_edge (pred, phiblock)->flags & EDGE_DFS_BACK)
                      ;
                    else
                      {
                        unsigned value_id = get_expr_value_id (constant);
                        constant = find_leader_in_sets (value_id, set1, set2,
                                                        AVAIL_OUT (pred));
                        if (constant)
                          return constant;

mitigates the fact that

            tree result = vn_nary_op_lookup_pieces (newnary->length,
                                                    newnary->opcode,
                                                    newnary->type,
                                                    &newnary->op[0],
                                                    &nary);
            if (result && is_gimple_min_invariant (result))
              return get_or_alloc_expr_for_constant (result);

doesn't allow SSA name result to prevail here.  That is vn_nary_simplify
also just looks up the expr now even if not simplified.  It also gets
fed leaders which are not necessarily final values and thus do not have
range-info cleared.

The SCCVN band-aid to clear SSA_NAME_RANGE_INFO doesn't apply here because
nothing is value-numbered to a.4_4 besides itself.  But phi-translation
effectively value-numbers an expression to it.

Reply via email to