summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorsimonpj@microsoft.com <unknown>2009-11-10 17:18:46 +0000
committersimonpj@microsoft.com <unknown>2009-11-10 17:18:46 +0000
commit7fa25f74d02cf36cb4997477c7527324104c74ee (patch)
tree71ab6d94ef5b45812acf20719ff2cc979e6afecd /compiler
parentb7aa1a08693f2b9b7c2ac9451b7be64f66f88be1 (diff)
downloadhaskell-7fa25f74d02cf36cb4997477c7527324104c74ee.tar.gz
Comments only
Diffstat (limited to 'compiler')
-rw-r--r--compiler/simplCore/OccurAnal.lhs22
1 files changed, 13 insertions, 9 deletions
diff --git a/compiler/simplCore/OccurAnal.lhs b/compiler/simplCore/OccurAnal.lhs
index f4eacd9ba7..2e07e089ed 100644
--- a/compiler/simplCore/OccurAnal.lhs
+++ b/compiler/simplCore/OccurAnal.lhs
@@ -539,9 +539,9 @@ reOrderCycle depth (bind : binds) pairs
_other -> 3 -- Data structures are more important than this
-- so that dictionary/method recursion unravels
- | is_con_app rhs = 5 -- Data types help with cases
- -- Includes dict funs
- -- Note [Constructor applictions]
+ | is_con_app rhs = 5 -- Data types help with cases: Note [Constructor applications]
+ -- Includes dict funs: Note [DFuns should not be loop breakers]
+
-- If an Id is marked "never inline" then it makes a great loop breaker
-- The only reason for not checking that here is that it is rare
@@ -555,8 +555,6 @@ reOrderCycle depth (bind : binds) pairs
-- the Id has some kind of unfolding
| otherwise = 0
- where
-
-- Checking for a constructor application
-- Cheap and cheerful; the simplifer moves casts out of the way
@@ -615,13 +613,14 @@ linear in the number of instance declarations.
Note [INLINE pragmas]
~~~~~~~~~~~~~~~~~~~~~
-Never choose a function with an INLINE pramga as the loop breaker!
+Avoid choosing a function with an INLINE pramga as the loop breaker!
If such a function is mutually-recursive with a non-INLINE thing,
then the latter should be the loop-breaker.
-A particular case is wrappers generated by the demand analyser.
-If you make then into a loop breaker you may get an infinite
-inlining loop. For example:
+Usually this is just a question of optimisation. But a particularly
+bad case is wrappers generated by the demand analyser: if you make
+then into a loop breaker you may get an infinite inlining loop. For
+example:
rec {
$wfoo x = ....foo x....
@@ -645,6 +644,11 @@ happened when we gave is_con_app a lower score than inline candidates:
Here we do *not* want to choose 'repTree' as the loop breaker.
+Note [DFuns should not be loop breakers]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+It's particularly bad to make a DFun into a loop breaker. See
+Note [How instance declarations are translated] in TcInstDcls
+
Note [Constructor applications]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It's really really important to inline dictionaries. Real