On Tue, 14 Aug 2012, Ulrich Weigand wrote: > Richard Guenther wrote: > > > Accessing loop_depth (bb->loop_father) isn't very expensive. The > > following removes the duplicate info in basic-blocks which is not > > properly kept up-to-date at the moment. > > Looks like this broke SPU build, since spu_machine_dependent_reorg > accesses ->loop_depth. According to comments in the code, this > was done because of concerns that loop_father may no longer be set up > this late in compilation, so I'm wondering whether just replacing > this by loop_depth (bb->loop_father) would work here ...
Well, if loops are no longer set up (thus ->loop_father is NULL) then the loop_depth information was stale and possibly wrong. > /* If this branch is a loop exit then propagate to previous > fallthru block. This catches the cases when it is a simple > loop or when there is an initial branch into the loop. */ > if (prev && (loop_exit || simple_loop) > && prev->loop_depth <= bb->loop_depth) > prop = prev; > > /* If there is only one adjacent predecessor. Don't propagate > outside this loop. This loop_depth test isn't perfect, but > I'm not sure the loop_father member is valid at this point. */ > else if (prev && single_pred_p (bb) > && prev->loop_depth == bb->loop_depth) > prop = prev; > > Any suggestions? If SPU md reorg would like to look at loop structures it should compute them. Simply call flow_loops_find, which hopefully works in CFG RTL mode (which I think is the mode available from md reorg?). I was simply throwing away loops after RTL loop optimizers not only because IRA for some weird reason decides to re-compute them in non-standard ways and because loop verification fails between ira / reload passes. So the other way would be to preserve loops for a longer period. Richard.