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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 8 got enhanced get_continuation_for_phi, previously we gave up for this
kind of CFG.

2017-05-04  Richard Biener  <rguent...@suse.de>

        * tree-ssa-alias.c (get_continuation_for_phi): Improve looking
        for the last VUSE which def dominates the PHI.  Directly call
        maybe_skip_until.
        (get_continuation_for_phi_1): Remove.

we do

  /* If not, look if we can reach such candidate by walking defs
     of a PHI arg without crossing other PHIs.  */
  if (! arg0)
    for (i = 0; i < nargs; ++i)
      {
        arg0 = PHI_ARG_DEF (phi, i);
        gimple *def = SSA_NAME_DEF_STMT (arg0);
        /* Backedges can't work.  */
        if (dominated_by_p (CDI_DOMINATORS,
                            gimple_bb (def), phi_bb))
          continue;
        /* See below.  */
        if (gimple_code (def) == GIMPLE_PHI)
          continue;
        while (! dominated_by_p (CDI_DOMINATORS,
                                 phi_bb, gimple_bb (def)))
          {
            arg0 = gimple_vuse (def);
            if (SSA_NAME_IS_DEFAULT_DEF (arg0))
              break;
            def = SSA_NAME_DEF_STMT (arg0);
            if (gimple_code (def) == GIMPLE_PHI)
              {
                /* Do not try to look through arbitrarily complicated
                   CFGs.  For those looking for the first VUSE starting
                   from the end of the immediate dominator of phi_bb
                   is likely faster.  */
                arg0 = NULL_TREE;
                goto next;
              }
          }
        break;
next:;
      }

which for the testcase can walk up the whole "right arm" of the CFG
repeatedly as well as computing the vuse to walk to.

Reply via email to