This is the mail archive of the 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 in CFG or CD-DCE?


I ran into this problem with the collection of patches I've got to
replace the dominator pass.  In execute/builtin-bitops-1.c, we get to
the pass prior to CD-DCE with the program looking somewhat like this:

<bb 0>:
  T.66_61 = -000000001;					[LIVE]
  T.67_62 = T.66_61 & 1;				[LIVE]
  if (T.67_62 != 0) goto <L39>; else goto <L38>;	[LIVE]

  i_3 = 0;						[DEAD]
  goto <bb 12> (<L26>);

  i_55 = 0;						[DEAD]

[ ... ]

  <D1756>_63 = 0;					[DEAD]

  exit (0);						[LIVE]
  T.71_52 = -000000001;					[DEAD XXX]
  T.72_53 = T.71_52 & 1;				[DEAD XXX]
  if (T.72_53 != 0) goto <L41>; else goto <L40>;	[DEAD XXX]

  <D1756>_47 = 0;					[DEAD]
  goto <bb 10> (<L22>);		<-- This is a fallthru edge (?)

What is happening here is that once we mark 'exit (0)' live, we go to
its CD parent (L41) and try to mark its last control statement as live. 
Strangely enough, that block has a FALLTHRU edge, so we mark nothing. 
The assignment '<D1756>_47 = 0' is really dead, but the 'if' statement
that I marked [DEAD XXX] should not go away because its in the CD chain
of that 'exit (0)' statement.

However, since we didn't find any statement in L41 to mark as live, we
kill the whole block, which prompts us to kill all of L26.  As of yet, I
have not been able to reproduce this without my local patches, so this
is something that is probably masked by DOM.

I have hacked CD-DCE to go keep going the CD chain when marking live
statements (mark_control_dependent_edges_necessary).  This prompts us to
go from L41 to L26 and mark the 'if' as needed.

But, it may be that the actual bug is in the flowgraph.  The edge from
L41 to L22 is marked as FALLTHRU.  Is that really accurate?  It looks
counter intuitive to me.  Shouldn't it be marked EDGE_DFS_BACK or


Thanks.  Diego.

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