[project @ 2002-01-10 10:29:09 by sof]
[ghc-hetmet.git] / ghc / compiler / stranal / StrictAnal.lhs
index 666d7ff..85aec7c 100644 (file)
@@ -7,6 +7,11 @@ The original version(s) of all strictness-analyser code (except the
 Semantique analyser) was written by Andy Gill.
 
 \begin{code}
+#ifndef DEBUG
+module StrictAnal ( ) where
+
+#else
+
 module StrictAnal ( saBinds ) where
 
 #include "HsVersions.h"
@@ -22,7 +27,7 @@ import ErrUtils               ( dumpIfSet_dyn )
 import SaAbsInt
 import SaLib
 import Demand          ( Demand, wwStrict, isStrict, isLazy )
-import Util            ( zipWith3Equal, stretchZipWith )
+import Util            ( zipWith3Equal, stretchZipWith, compareLength )
 import BasicTypes      ( Activation( NeverActive ) )
 import Outputable
 import FastTypes
@@ -80,12 +85,6 @@ strict workers.
 
 \begin{code}
 saBinds :: DynFlags -> [CoreBind] -> IO [CoreBind]
-#ifndef DEBUG
--- Omit strictness analyser if DEBUG is off
-
-saBinds dflags binds = return binds
-
-#else
 saBinds dflags binds
   = do {
        showPass dflags "Strictness analysis";
@@ -233,7 +232,9 @@ saApp str_env abs_env (fun, args)
   where
     arg_dmds = case fun of
                 Var var -> case lookupAbsValEnv str_env var of
-                               Just (AbsApproxFun ds _) | length ds >= length args 
+                               Just (AbsApproxFun ds _) 
+                                  | compareLength ds args /= LT 
+                                             -- 'ds' is at least as long as 'args'.
                                        -> ds ++ minDemands
                                other   -> minDemands
                 other -> minDemands
@@ -488,5 +489,6 @@ sequenceSa []     = returnSa []
 sequenceSa (m:ms) = m            `thenSa` \ r ->
                    sequenceSa ms `thenSa` \ rs ->
                    returnSa (r:rs)
+
 #endif /* DEBUG */
 \end{code}