[keep track of used ids and don't reused them so inlining can proceed unfettered.
John Meacham <john@repetae.net>**20051003034820] hunk ./E/LetFloat.hs 25
-import E.Values
hunk ./E/LetFloat.hs 27
-import qualified Info.Info as Info
hunk ./E/LetFloat.hs 29
-import Util.SameShape
hunk ./E/LetFloat.hs 50
-atomizeApps :: Stats -> E -> IO E
-atomizeApps stats e = traverse travOptions { pruneRecord = varElim stats } f mempty mempty e where
+atomizeApps :: Set.Set Id -> Stats -> E -> IO E
+atomizeApps usedIds stats e = traverse travOptions { pruneRecord = varElim stats } f mempty (Map.fromAscList [ (i,NotKnown) | i <- Set.toAscList usedIds ]) e where
hunk ./E/LetFloat.hs 66
+    f _ _ = error "LetFloat: odd f"
hunk ./Ho.hs 11
+import qualified Data.Set as Set
hunk ./Ho.hs 95
-    hoRules :: Rules
+    hoRules :: Rules,
+    hoUsedIds :: Set.Set Id
hunk ./Main.hs 4
-import Char
hunk ./Main.hs 6
+import Control.Monad.Writer
hunk ./Main.hs 9
-import Maybe
hunk ./Main.hs 160
-    ds <- flip mapM ds $ \ (n,v,lc) -> do
-        lc <- postProcessE stats n inscope fullDataTable lc
+    let procE (ds,usedIds) (n,v,lc) = do
+        lc <- postProcessE stats n inscope usedIds fullDataTable lc
hunk ./Main.hs 164
-        return (n, shouldBeExported exports v,lc)
+        return ((n, shouldBeExported exports v,lc):ds,usedIds `mappend` collectIds lc)
+    (ds,allIds) <- foldM procE ([],hoUsedIds ho) ds
hunk ./Main.hs 194
+
hunk ./Main.hs 197
-    return ho' { hoDataTable = dataTable, hoEs = Map.fromList [ (x,(y,z)) | (x,y,z) <- ds'], hoRules = rules }
+    return ho' { hoDataTable = dataTable, hoEs = Map.fromList [ (x,(y,z)) | (x,y,z) <- ds'], hoRules = rules, hoUsedIds = collectIds (ELetRec [ (b,c) | (_,b,c) <- ds'] Unknown) }
hunk ./Main.hs 204
-postProcessE :: Stats.Stats -> Name -> [Id] -> DataTable -> E -> IO E
-postProcessE stats n inscope dataTable lc = do
+postProcessE :: Stats.Stats -> Name -> [Id] -> Set.Set Id -> DataTable -> E -> IO E
+postProcessE stats n inscope usedIds dataTable lc = do
hunk ./Main.hs 216
-    lc <- mangle (return ()) False ("Barendregt: " ++ show n) (return . barendregt) lc
-    lc <- doopt mangle False stats "FixupLets..." (\stats x -> atomizeApps stats x >>= coalesceLets stats)  lc
+    --lc <- mangle (return ()) False ("Barendregt: " ++ show n) (return . barendregt) lc
+    lc <- doopt mangle False stats "FixupLets..." (\stats x -> atomizeApps usedIds stats x >>= coalesceLets stats)  lc
hunk ./Main.hs 226
+collectIds e = execWriter $ annotate mempty (\id nfo -> tell (Set.singleton id) >> return nfo) (\_ -> return) (\_ -> return) e
hunk ./Main.hs 295
-    lc <- mangle dataTable (return ()) True  "FixupLets..." (\x -> atomizeApps stats x >>= coalesceLets stats)  lc
+    lc <- mangle dataTable (return ()) True  "FixupLets..." (\x -> atomizeApps mempty stats x >>= coalesceLets stats)  lc