[project @ 1999-10-18 11:44:20 by kglynn]
authorkglynn <unknown>
Mon, 18 Oct 1999 11:44:20 +0000 (11:44 +0000)
committerkglynn <unknown>
Mon, 18 Oct 1999 11:44:20 +0000 (11:44 +0000)
The fix to ignore error() cases when doing CPR analysis exposed a
problem with the Void type.  A function that always constructs a void
result was converted to w/w, but the worker was producing an unboxed
tuple with 0 components.  Not good.

Fixed so that constructing a void gives CPR value Top.  This is OK
because we won't really be constructing a void each time, we will be
returning a pointer to a shared void cell.

ghc/compiler/cprAnalysis/CprAnalyse.lhs

index 8c09c65..6c491e2 100644 (file)
@@ -221,7 +221,14 @@ cprAnalExpr rho e@(Var v)
 -- has product type then this is a manifest constructor (hooray!)
 cprAnalExpr rho (Con con args)
     = (Con con args_cpr, 
-       if isConProdType con
+       -- If we are a product with 0 args we must be void(like)
+       -- We can't create an unboxed tuple with 0 args for this
+       -- and since Void has only one, constant value it should 
+       -- just mean returning a pointer to a pre-existing cell. 
+       -- So we won't really gain from doing anything fancy
+       -- and we treat this case as Top.
+       if    isConProdType con
+          && length args > 0
          then Tuple args_aval_filt_funs
          else Top)
     where