[MLton-devel] bug in SSA knownCase restore pass
Stephen Weeks
MLton@mlton.org
Wed, 18 Dec 2002 17:54:15 -0800
There is a bug in the interaction between the SSA knownCase
optimization and the SSA restore pass. Here's a trace of the
failure compiling mlyacc -diag knownCase (with my current working
version).
display starting
knownCase starting
knownCase raised in 2.00 + 0.56 (22% GC)
display raised in 2.00 + 0.56 (22% GC)
closureConvertSimplify raised in 7.92 + 1.61 (17% GC)
pre codegen raised in 10.06 + 2.14 (18% GC)
Compile SML raised in 10.06 + 2.14 (18% GC)
MLton raised in 10.06 + 2.14 (18% GC)
shrinker raised L_7036 has no index property
The problem happens because knownCase produces an unreachable handler,
which the restore pass then removes the definition of, leaving an
invalid HandlerPop/Push. Here is a snippet of the broken SSA from the
diag.
knownCase produces a function containing the following blocks.
L_7035 ()
HandlerPush L_7036
L_7038 ()
L_7038 ()
L_7039 ()
L_7039 ()
x_8886 = Array_sub (x_7296, x_8855)
L_7042 (x_8886)
L_7042 (x_8887)
HandlerPop L_7036
L_7043 (x_8887)
L_7037 ()
HandlerPush L_7040
L_7041 (x_108 (x_8855)) handle L_7040
L_7040 (x_8885)
HandlerPop L_7040
L_7036 (x_8885)
L_7041 (x_8884)
HandlerPop L_7040
L_7042 (append_0 (x_8884, global_1017)) handle L_7036
L_7036 (x_8888)
HandlerPop L_7036
L_7027 (x_8888)
The important point is that L_7041 is unreachable, as the following
preds = [] from the diag shows.
L_7041 {preds = [],
defs = (),
uses = (),
live = (),
dtindex = ~1,
df = Unevaluated,
phiArgs = ()}
The restore pass then removes L_7041, but leaves the HandlerPush and
Pop, producing the following.
L_7035 ()
HandlerPush L_7036
L_7038 ()
L_7038 ()
L_7039 ()
L_7039 ()
x_8886 = Array_sub (x_7296, x_8855)
L_7042 (x_8886)
L_7042 (x_8887)
HandlerPop L_7036
L_7043 (x_8887)
The shrinker then (correctly) barfs on this.
Either the restore pass should correctly handle unreachable blocks or
knownCase (and anyone else that uses restore) should first eliminate
unreachable blocks. Matthew, can you look into fixing this?
-------------------------------------------------------
This SF.NET email is sponsored by: Order your Holiday Geek Presents Now!
Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap,
MP3 Players, XBox Games, Flying Saucers, WebCams, Smart Putty.
T H I N K G E E K . C O M http://www.thinkgeek.com/sf/
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel