Bad code from egcs-1.1b

Jeffrey A Law law@cygnus.com
Sun Oct 25 21:47:00 GMT 1998


  In message < u9g1cbc2u2.fsf@yorick.cygnus.com >you write:
  > >>>>> Jeffrey A Law <law@cygnus.com> writes:
  > 
  >  > jump.c::duplicate_loop_exit_test simply refuses to roll loops in this
  >  > manner if it finds a BLOCK_{BEGIN,END} note.  We could do the same.  I
  >  > don't see many alternatives.
  > 
  > The jump code refuses because duplicating the notes is invalid.  Moving
  > them isn't, so long as the order is preserved, and it seems to me that the
  > order would only be broken iff the test contains block notes and the loop
  > body contains block notes.  That seems quite testable.
Well, if jump.c moved them, then we'd probably be in the same boat as we
are in stmt.c :-)  Though possibly it wouldn't be able to since the cleanup
code would have been inserted which may (or may not) inhibit the optimization.

  > Another possibility would be to associate the fixup with something
  > other than a block; perhaps a code_label?
This is interesting.  Assuming I understand the problem, you actually don't
want to associate with the note or any existing label, but instead the edge
as you leave an inner scope to an outer scope.

We don't want to associate with the inner scope due to the problem we're
trying to solve now.

We don't want to associate with anything that currently exists in the outer
scope because any point we select may potentially be reachable from multiple
threads of control.

Instead we want to run cleanups after we exit the inner scope, but before we
enter the outer scope.  Any optimizer geeks still listening may recognize this
as nearly idential to critical edge problems in global optimizers.

We solve those problems by creating a new intermediate block to hold instructions
which can't be placed at either the head or tail of an edge.  We can use the
same technique here I suspect.


We associate the cleanup with a new label and redirect jumps out of the inner
scope to this new label.  After the new label, we have a jump to the target
label in the outer scope.  We insert our cleanup code after the new label, but
before the jump to the outer scope.

This is probably more complicated than we want to tackle at the moment (then
again, for someone familiar with this code, maybe not).

  >  > Is there any way to distinguish between a random BLOCK_{BEG,END} and one
  >  > used for placement of cleanups?
  > 
  > You could scan goto_fixup_chain, I suppose.  See expand_fixup for how they
  > are created.
Yea, that looks pretty straightforward.  I can do this if you don't want to
try and tackle the potential solution I mentioned above.

jeff



More information about the Gcc-bugs mailing list