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

--- Comment #5 from Drea Pinski <pinskia at gcc dot gnu.org> ---
Actually wait this might be only a bug in the forwprop valueizer.  
```
/* Primitive "lattice" function for gimple_simplify.  */

static tree
fwprop_ssa_val (tree name)
{
  /* First valueize NAME.  */
  if (TREE_CODE (name) == SSA_NAME
      && SSA_NAME_VERSION (name) < lattice.length ())
    {
      tree val = lattice[SSA_NAME_VERSION (name)];
      if (val)
        name = val;
    }
  /* We continue matching along SSA use-def edges for SSA names
     that are not single-use.  Currently there are no patterns
     that would cause any issues with that.  */
  return name;
}
...

              if (may_propagate_copy (res, first))
                to_remove_defs.safe_push (SSA_NAME_VERSION (res));
              fwprop_set_lattice_val (res, first);


```

So we set the lattice even if may_propagate_copy return false. So then we look
through the PHI copy but the PHI here needs to stay because of abnormal edge.
So the simple change is fix fwprop_ssa_val not to look past
SSA_NAME_OCCURS_IN_ABNORMAL_PHI copies.

Reply via email to