[MLton-devel] Problem with -exn-history true

Stephen Weeks MLton@mlton.org
Tue, 20 Aug 2002 20:40:19 -0700


I agree that the bug happens because the useless pass depends on its
input having no unreachable blocks and the shrink pass does not
enforce this.  As I recall, the shrinker does for exactly the reason
you mention -- the DFS has to make a decision too early and I couldn't
figure out another cheap way to enforce it.  Since the type checker
does not check for this invariant, my guess is that we never meant to
have it enforced.  Another point in favor of this viewpoint is that
the backend has a pass to eliminate unreachable blocks from the RSSA.

To fix the problem, I see two ways to go. 

1. The way that you propose, making "all blocks are reachable in the
   control-flow graph" an invariant, checking for it in the type
   checker, and enforcing it in the shrinker.  If we do this, I much
   prefer the simpler approach of a separate iteration over the blocks
   to remove unreachable ones.

2. Leaving the invariant as is, allowing unreachable blocks, and only
   eliminating unreachable blocks before passes that can't handle them
   (useless being the only such pass we know of).

I prefer (2) since it has a lower run-time cost, with only one pass
per compile instead of one extra pass per shrink (> 20 passes in
all).  Also, (2) is a smaller change to the optimizer overall.


-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel