This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/47737] [4.6 Regression] wrong code with -funswitch-loops -fno-tree-dominator-opts -fgraphite-identity


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

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot       |rguenther at suse dot de
                   |gnu.org                     |

--- Comment #3 from Jeffrey A. Law <law at redhat dot com> 2011-02-17 22:31:39 UTC ---
I can't see any way this code is correct:

  /* We have to verify that one edge into the PHI node is dominated
     by the true edge of the predicate block and the other edge
     dominated by the false edge.  This ensures that the PHI argument
     we are going to take is completely determined by the path we
     take from the predicate block.  */


Consider this CFG fragment.


             5
            / \
           6-->7
            \ /
             8


ie edges (5,6) (5,7) (6,7) (6,8) (7,8) 

Assume we have a PHI with two constant args in block #8 and DOM is block #5. 
Assume true_edge is (5,7) and false_edge is (5,6).

Clearly one can see that the edge (5,7) does _not_ dominate (7,8).  However,
the code in question gets it wrong.

  tem = EDGE_PRED (bb, 0);
  if (tem == true_edge
      || tem->src == true_edge->dest
      || dominated_by_p (CDI_DOMINATORS,
                         tem->src, true_edge->dest))
    arg0 = PHI_ARG_DEF (phi, tem->dest_idx);
  else if (tem == false_edge
           || tem->src == false_edge->dest
           || dominated_by_p (CDI_DOMINATORS,
                              tem->src, false_edge->dest))
    arg1 = PHI_ARG_DEF (phi, tem->dest_idx);
  else

Assume tem is the edge (7,8).  Obviously it is not true_edge (5,7).  However
tem->src == true_edge->dest and we record arg0 and believe we had a dominance
relationship between true_edge and tem.

Richard, how was this supposed to work?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]