From f021fc6f0027142f5fb1bdb725a86ded8008c5e7 Mon Sep 17 00:00:00 2001 From: kglynn Date: Mon, 18 Oct 1999 11:44:20 +0000 Subject: [PATCH] [project @ 1999-10-18 11:44:20 by kglynn] 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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ghc/compiler/cprAnalysis/CprAnalyse.lhs b/ghc/compiler/cprAnalysis/CprAnalyse.lhs index 8c09c65..6c491e2 100644 --- a/ghc/compiler/cprAnalysis/CprAnalyse.lhs +++ b/ghc/compiler/cprAnalysis/CprAnalyse.lhs @@ -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 -- 1.7.10.4