#2598: Avoid excessive specialisation in SpecConstr
-----------------------------+----------------------------------------------
Reporter: simonpj | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.8.3
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Architecture: Unknown
Os: Unknown |
-----------------------------+----------------------------------------------
Comment (by rl):
It might actually be better to decide whether to specialise or not
depending on how an argument is used in the function instead of what it is
bound to in a call. So for dropComment we'd see:
{{{
dropComment xs = case xs of
[] -> []
x:xs -> <big chunk of code>
}}}
Now, we might decide that specialising for `dropComment (x:xs)` isn't
worth it because we will only get rid of the one `case` which doesn't buy
us much. I have no idea what the exact heuristic should be but since we
are worried about code size that should probably be the main criterion.
BTW, the five tiny specialisations are only kept alive by rules. For
instance:
{{{
$sdropComment3 xs c = '-' : dropComment2 xs c
"SC:dropComment5" forall xs c.
dropComment ('-' : '-': c : xs) = dropComment3 xs c
}}}
Since dropComment3 is very small and the only reference to it is on the
rhs of the rule, I can easily imagine a pass which simply inlines it there
and drops the binding.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2598#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs