[only rerun optimizer if type analysis pass finds something interesting.
John Meacham <john@repetae.net>**20060317031618] hunk ./E/TypeAnalysis.hs 49
-typeAnalyze :: Program -> IO Program
+typeAnalyze :: Program -> IO (Program,Bool)
hunk ./E/TypeAnalysis.hs 77
-    printStat "TypeAnalysis" stats
-
-    return prog
+    when (stats /= mempty) $ printStat "TypeAnalysis" stats
+    return (prog,stats /= mempty)
hunk ./Main.hs 329
-    prog <- if (fopts FO.TypeAnalysis) then do typeAnalyze prog else return prog
-    prog <- if null $ programDs prog then return prog else do
-        ne <- (return . barendregt) (programE prog)
-        return $ programSetE ne prog
+    (prog,didSomething) <- if (fopts FO.TypeAnalysis) then do typeAnalyze prog else return (prog,False)
hunk ./Main.hs 331
-    Stats.clear stats
hunk ./Main.hs 332
-    let graph =  (newGraph (programDs prog) (\ (b,_) -> tvrIdent b) (\ (b,c) -> bindingFreeVars b c))
-        fscc (Left n) = (False,[n])
-        fscc (Right ns) = (True,ns)
-    (ds,_) <- foldM f ([],(Map.fromList [ (tvrIdent v,e) | (v,e) <- Map.elems (hoEs ho)], initMap, Set.empty)) (map fscc $ scc graph)
-    progress "!"
-    prog <- return $ programSetDs ds prog
+    prog <- if didSomething then do
+        prog <- if null $ programDs prog then return prog else do
+            ne <- (return . barendregt) (programE prog)
+            return $ programSetE ne prog
+        let graph =  (newGraph (programDs prog) (\ (b,_) -> tvrIdent b) (\ (b,c) -> bindingFreeVars b c))
+            fscc (Left n) = (False,[n])
+            fscc (Right ns) = (True,ns)
+        (ds,_) <- foldM f ([],(Map.fromList [ (tvrIdent v,e) | (v,e) <- Map.elems (hoEs ho)], initMap, Set.empty)) (map fscc $ scc graph)
+        progress "!"
+        return $ programSetDs ds prog
+      else return prog
hunk ./Main.hs 344
-    Stats.print "Optimization" stats
hunk ./Main.hs 423
-    prog <- if (fopts FO.TypeAnalysis) then do typeAnalyze prog else return prog
+    (prog,_) <- if (fopts FO.TypeAnalysis) then do typeAnalyze prog else return (prog,False)
hunk ./Stats.hs 133
+    deriving(Eq,Ord)