[use new substMap'' for applying substitutions, don't annotate variables that arn't let-bound with occurance info.
John Meacham <john@repetae.net>**20060411032506] hunk ./E/SSimplify.hs 108
-            Just occ -> tell (mdelete n tfvs) >> return (EPi (annb occ tvr { tvrType = a }) b)
+            Just occ -> tell (mdelete n tfvs) >> return (EPi (annb' tvr { tvrType = a }) b)
hunk ./E/SSimplify.hs 127
-            as'' = map (annbind avs) as'
+            as'' = map (annbind' avs) as'
hunk ./E/SSimplify.hs 147
-        return ec { eCaseScrutinee = scrut', eCaseAlts = as', eCaseBind = annbind fidm b, eCaseType = ct, eCaseDefault = d'}
+        return ec { eCaseScrutinee = scrut', eCaseAlts = as', eCaseBind = annbind' fidm b, eCaseType = ct, eCaseDefault = d'}
hunk ./E/SSimplify.hs 159
-            l' = mapLitBinds (annbind fvs) l
+            l' = mapLitBinds (annbind' fvs) l
hunk ./E/SSimplify.hs 169
-annb x tvr = tvrInfo_u (Info.insert x) tvr
+-- delete any occurance info for non-let-bound vars to be safe
+annb' tvr = tvrInfo_u (Info.delete Many) tvr
+annbind' idm tvr = case mlookup (tvrIdent tvr) idm of
+    Nothing -> annb' tvr { tvrIdent = 0 }
+    Just _ -> annb' tvr
+
+-- add ocucrance info
hunk ./E/SSimplify.hs 179
+annb x tvr = tvrInfo_u (Info.insert x) tvr
+
hunk ./E/SSimplify.hs 280
-applySubst :: Subst -> E -> E
-applySubst s = substMap'' tm where
-    tm = fmap g s
-    g (Done e) = e
-    g (Susp e s') = applySubst s' e
+applySubst :: Subst -> IdMap a -> E -> E
+applySubst s nn = applySubst' s where
+    nn' = fmap (const Nothing) s `mappend` fmap (const Nothing) nn
+    applySubst' s = substMap'' (tm `mappend` nn') where
+        tm = fmap g s
+        g (Done e) = Just e
+        g (Susp e s') = Just $ applySubst' s' e
hunk ./E/SSimplify.hs 288
-dosub sub e = coerceOpt return $ applySubst sub e
+dosub sub inb e = coerceOpt return $ applySubst sub (envInScope inb) e
hunk ./E/SSimplify.hs 329
-        xs' <- mapM (dosub sub) xs
+        xs' <- mapM (dosub sub inb) xs
hunk ./E/SSimplify.hs 343
-                xs' <- mapM (dosub sub) xs
+                xs' <- mapM (dosub sub inb) xs
hunk ./E/SSimplify.hs 349
-        es' <- mapM (dosub sub) es
-        t' <- dosub sub t
+        es' <- mapM (dosub sub inb) es
+        t' <- dosub sub inb t
hunk ./E/SSimplify.hs 353
-        es' <- mapM (dosub sub) es
-        t' <- dosub sub t
+        es' <- mapM (dosub sub inb) es
+        t' <- dosub sub inb t
hunk ./E/SSimplify.hs 357
-        t' <- dosub sub t
+        t' <- dosub sub inb t
hunk ./E/SSimplify.hs 361
-        e' <- dosub sub e
+        e' <- dosub sub inb e
hunk ./E/SSimplify.hs 364
-        t' <- dosub sub t
+        t' <- dosub sub inb t
hunk ./E/SSimplify.hs 442
-        t' <- dosub sub t
-        let t'' = substMap'' (fmap (\ IsBoundTo { bindingE = e } -> e) $ mfilter isIsBoundTo (envInScope inb)) t'
+        t' <- dosub sub inb t
+        let t'' = substMap'' (fmap (\ IsBoundTo { bindingE = e } -> Just e) $ mfilter isIsBoundTo (envInScope inb)) t'
hunk ./E/SSimplify.hs 466
-        t' <- dosub sub t
+        t' <- dosub sub inb t
hunk ./E/SSimplify.hs 482
-        t' <- dosub sub t
+        t' <- dosub sub inb t
hunk ./E/SSimplify.hs 527
-                t' <- dosub sub t
+                t' <- dosub sub inb t
hunk ./E/SSimplify.hs 532
-                t' <- dosub sub t
+                t' <- dosub sub inb t
hunk ./E/SSimplify.hs 544
-        t' <- dosub sub t
+        t' <- dosub sub inb t
hunk ./E/SSimplify.hs 548
-        t' <- dosub sub t
+        t' <- dosub sub inb t
hunk ./E/SSimplify.hs 585
-
-{-
-    h v xs' inb  | so_superInline sopts, si@(_:_) <- [ (tvr,fromJust body) | EVar tvr <- xs', forceSuperInline tvr, let body = haveBody tvr, isJust body ] = do
-        mapM_ (\v -> mtick  (toAtom $ "E.Simplify.inline.superforced.{" ++ tvrShowName v  ++ "}")) (fsts si)
-        let siName x = case fromId x of
-                Just y ->  [toId (toName Val ("SI@",'f':show y ++ "$" ++ show i)) | i <- [(1::Int)..] ]
-                Nothing -> [toId (toName Val ("SI@",'f':show x ++ "$" ++ show i)) | i <- [(1::Int)..] ]
-        zs <- flip mapM si $ \ (t,b) -> do
-            nn <- newNameFrom (siName (tvrIdent t))
-            let t' = unsetProperty prop_SUPERINLINE t { tvrIdent = nn }
-            return (t,t',subst t (EVar t') b)
-        let xs'' = map (substLet [ (t,EVar t') | (t,t',_) <- zs]) xs'
-        e <- app (v,xs'')
-        return (eLetRec [ (t',b) | (_,t',b) <- zs] e)
-       where
-            haveBody tvr = case Map.lookup (tvrIdent tvr) (envInScope inb) of
-                Just IsBoundTo { bindingE = e } -> Just e
-                _ -> Nothing
-  -}
-