Fix Trac #1988; keep the ru_fn field of a RULE up to date
[ghc-hetmet.git] / compiler / simplCore / SimplCore.lhs
index ded393f..844c401 100644 (file)
@@ -4,11 +4,11 @@
 \section[SimplCore]{Driver for simplifying @Core@ programs}
 
 \begin{code}
-{-# OPTIONS_GHC -w #-}
+{-# OPTIONS -w #-}
 -- The above warning supression flag is a temporary kludge.
 -- While working on this module you are encouraged to remove it and fix
 -- any warnings in the module. See
---     http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions#Warnings
+--     http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings
 -- for details
 
 module SimplCore ( core2core, simplifyExpr ) where
@@ -29,7 +29,7 @@ import Rules          ( RuleBase, emptyRuleBase, mkRuleBase, unionRuleBase,
 import PprCore         ( pprCoreBindings, pprCoreExpr, pprRules )
 import OccurAnal       ( occurAnalysePgm, occurAnalyseExpr )
 import IdInfo          ( setNewStrictnessInfo, newStrictnessInfo, 
-                         setWorkerInfo, workerInfo,
+                         setWorkerInfo, workerInfo, setSpecInfoHead,
                          setInlinePragInfo, inlinePragInfo,
                          setSpecInfo, specInfo, specInfoRules )
 import CoreUtils       ( coreBindsSize )
@@ -37,7 +37,7 @@ import Simplify               ( simplTopBinds, simplExpr )
 import SimplEnv                ( SimplEnv, simplBinders, mkSimplEnv, setInScopeSet )
 import SimplMonad
 import ErrUtils                ( dumpIfSet, dumpIfSet_dyn, showPass )
-import CoreLint                ( endPass )
+import CoreLint                ( endPass, endIteration )
 import FloatIn         ( floatInwards )
 import FloatOut                ( floatOutwards )
 import FamInstEnv
@@ -407,7 +407,7 @@ simplifyPgm mode switches hsc_env us imp_rule_base guts
                         text "",
                         pprSimplCount counts_out]);
 
-       endPass dflags ("Simplify phase " ++ phase_info ++ " done") Opt_D_verbose_core2core binds';
+       endPass dflags ("Simplify phase " ++ phase_info ++ " done") Opt_D_dump_simpl_phases binds';
 
        return (counts_out, guts { mg_binds = binds' })
     }
@@ -429,7 +429,7 @@ simplifyPgm mode switches hsc_env us imp_rule_base guts
            if  max_iterations > 2 then
                hPutStr stderr ("NOTE: Simplifier still going after " ++ 
                                show max_iterations ++ 
-                               " iterations; bailing out.\n")
+                               " iterations; bailing out.  Size = " ++ show (coreBindsSize binds) ++ "\n" )
            else 
                return ();
 #endif
@@ -497,7 +497,7 @@ simplifyPgm mode switches hsc_env us imp_rule_base guts
                -- Dump the result of this iteration
           dumpIfSet_dyn dflags Opt_D_dump_simpl_iterations herald
                         (pprSimplCount counts') ;
-          endPass dflags herald Opt_D_dump_simpl_iterations binds'' ;
+          endIteration dflags herald Opt_D_dump_simpl_iterations binds'' ;
 
                -- Loop
           do_iteration us2 (iteration_no + 1) all_counts binds''
@@ -700,6 +700,9 @@ transferIdInfo exported_id local_id
     transfer exp_info = exp_info `setNewStrictnessInfo` newStrictnessInfo local_info
                                 `setWorkerInfo`        workerInfo local_info
                                 `setInlinePragInfo`    inlinePragInfo local_info
-                                `setSpecInfo`          addSpecInfo (specInfo exp_info)
-                                                                   (specInfo local_info)
+                                `setSpecInfo`          addSpecInfo (specInfo exp_info) new_info
+    new_info = setSpecInfoHead (idName exported_id) 
+                              (specInfo local_info)
+       -- Remember to set the function-name field of the
+       -- rules as we transfer them from one function to another
 \end{code}