http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56756
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> 2013-03-28
12:34:24 UTC ---
Ok, so one reason is that we simply "ignore" dependencies when computing
what stmts to move (which happens in the same processing order):
static bool
add_dependency (tree def, struct lim_aux_data *data, struct loop *loop,
bool add_cost)
{
...
max_loop = outermost_invariant_loop (def, loop);
if (!max_loop)
return false;
...
def_data = get_lim_data (def_stmt);
if (!def_data)
return true;
so, when we don't know anything about the stmt we depend on because we
didn't visit it yet outermost_invariant_loop returns garbage in this case.
But I got side-tracked by the above (which still should be fixed IMHO),
as also store-motion does not properly initialize dependence.