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

--- Comment #9 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2011-09-13 
15:24:08 UTC ---
OK, the problem appears to originate earlier, sometime during
canonicalize_loop_closed_ssa_form ().  After canonicalization, we have:

<bb 45>:
  # err2.395_571 = PHI <err2.395_561(73)>
  # err2_lsm.820_574 = PHI <err2.395_561(73)>

This violates the last documented condition of canonicalized loop-closed SSA
form:

/* Converts the current loop closed SSA form to a canonical form
   expected by the Graphite code generation.

   The loop closed SSA form has the following invariant: a variable
   defined in a loop that is used outside the loop appears only in the
   phi nodes in the destination of the loop exit.  These phi nodes are
   called close phi nodes.

   The canonical loop closed SSA form contains the extra invariants:

   - when the loop contains only one exit, the close phi nodes contain
   only one argument.  That implies that the basic block that contains
   the close phi nodes has only one predecessor, that is a basic block
   in the loop.

   - the basic block containing the close phi nodes does not contain
   other statements.

   - there exist only one phi node per definition in the loop.
*/

The definition of err2.395_561 in block 43 reaches both of these PHIs. 
Furthermore, the PHIs indicate the definition is in the newly introduced block
73, which is not the case:

<bb 43>:
  # err2.395_561 = PHI <err2.395_219(41)>

<bb 73>:
  n_223 = n_33 + 1;
  if (n_33 == 12)
    goto <bb 45>;
  else
    goto <bb 44>;

I'll dig into the canonicalization code to see what's going on.

Reply via email to