http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59715

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
virtual SSA form is broken, we have overlapping life-ranges - a virtual PHI
node is missing in bb 6, seems to be broken by store sinking (-fno-tree-sink
fixes it).  The virtual SSA form updating is too simple:

      /* Update virtual operands of statements in the path we
         do not sink to.  */
      if (gimple_vdef (stmt))
        {
          imm_use_iterator iter;
          use_operand_p use_p;
          gimple vuse_stmt;

          FOR_EACH_IMM_USE_STMT (vuse_stmt, iter, gimple_vdef (stmt))
            if (gimple_code (vuse_stmt) != GIMPLE_PHI)
              FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
                SET_USE (use_p, gimple_vuse (stmt));
        }

as in this case we sink

    store
     |  \
     x   |
    / \  |
   /   \ y ---
  /           \
needed-here    \
              but not here

sinking assumes that critical edges are split - but tail-merging breaks this
assumption, breaking sinking.  With critical edges split we can insert
on the edge to needed-here.

Either dumb down sinking (detect the critical edge case and don't sink),
make it insert on edges instead, or restore previous behavior to have
critical edges split after PRE (note it may be already partly broken
before as cfg-cleanup unsplits edges again).

So it is tail-merging introducing this after all, but not necessarily
tail-mergings fault.

Reply via email to