[MLton-commit] r4690
Stephen Weeks
MLton@mlton.org
Thu, 3 Aug 2006 22:48:33 -0700
Fixed bug in the "useless" SSA optimization pass, caused by calling an
imported C function and then ignoring the result. The useless pass
eliminated the result, which changed the return type of the call, and
led to a type error. The fix was simply to force FFI arguments and
results to be useful.
----------------------------------------------------------------------
U mlton/trunk/doc/changelog
U mlton/trunk/mlton/ssa/useless.fun
----------------------------------------------------------------------
Modified: mlton/trunk/doc/changelog
===================================================================
--- mlton/trunk/doc/changelog 2006-07-19 02:50:56 UTC (rev 4689)
+++ mlton/trunk/doc/changelog 2006-08-04 05:48:22 UTC (rev 4690)
@@ -1,5 +1,9 @@
Here are the changes since version 20051202.
+* 2006-08-03
+ - Fixed a bug in the "useless" SSA optimization, caused by calling
+ an imported C function and then ignoring the result.
+
* 2006-06-24
- Fixed a bug in pass to flatten data structures. Thanks to Joe Hurd
for the bug report.
Modified: mlton/trunk/mlton/ssa/useless.fun
===================================================================
--- mlton/trunk/mlton/ssa/useless.fun 2006-07-19 02:50:56 UTC (rev 4689)
+++ mlton/trunk/mlton/ssa/useless.fun 2006-08-04 05:48:22 UTC (rev 4690)
@@ -520,6 +520,9 @@
(unify (l, l'); unifySlot (e, e'))
| _ => Error.bug "Useless.primApp: Array_toVector")
| Array_update => update ()
+ | FFI _ =>
+ (Vector.foreach (args, deepMakeUseful);
+ deepMakeUseful result)
| MLton_equal => Vector.foreach (args, deepMakeUseful)
| Ref_assign => coerce {from = arg 1, to = deref (arg 0)}
| Ref_deref => return (deref (arg 0))