[project @ 2001-04-27 15:39:18 by sewardj]
[ghc-hetmet.git] / ghc / compiler / cprAnalysis / CprAnalyse.lhs
index a390179..760d142 100644 (file)
@@ -7,11 +7,11 @@ module CprAnalyse ( cprAnalyse ) where
 #include "HsVersions.h"
 
 import CmdLineOpts     ( DynFlags, DynFlag(..), dopt )
-import CoreLint                ( beginPass, endPass )
+import CoreLint                ( showPass, endPass )
 import CoreSyn
 import CoreUtils       ( exprIsValue )
 import Id               ( Id, setIdCprInfo, idCprInfo, idArity,
-                         isBottomingId, idDemandInfo )
+                         isBottomingId, idDemandInfo, isImplicitId )
 import IdInfo           ( CprInfo(..) )
 import Demand          ( isStrict )
 import VarEnv
@@ -137,11 +137,10 @@ ids decorated with their CprInfo pragmas.
 cprAnalyse :: DynFlags -> [CoreBind] -> IO [CoreBind]
 cprAnalyse dflags binds
   = do {
-       beginPass dflags "Constructed Product analysis" ;
+       showPass dflags "Constructed Product analysis" ;
        let { binds_plus_cpr = do_prog binds } ;
        endPass dflags "Constructed Product analysis" 
-               (dopt Opt_D_dump_cpranal dflags || dopt Opt_D_verbose_core2core dflags)
-               binds_plus_cpr
+               Opt_D_dump_cpranal binds_plus_cpr
     }
   where
     do_prog :: [CoreBind] -> [CoreBind]
@@ -156,6 +155,9 @@ with ids decorated with their CPR info.
 -- Return environment extended with info from this binding 
 cprAnalBind :: CPREnv -> CoreBind -> (CPREnv, CoreBind)
 cprAnalBind rho (NonRec b e) 
+  | isImplicitId b     -- Don't touch the CPR info on constructors, selectors etc
+  = (rho, NonRec b e)  
+  | otherwise
   = (extendVarEnv rho b absval, NonRec b' e')
   where
     (e', absval) = cprAnalExpr rho e