#3831: SpecConstr should exploit cases where there is exactly one call pattern
---------------------------------+------------------------------------------
Reporter: igloo | Owner:
Type: bug | Status: new
Priority: high | Milestone: 6.12.2
Component: Compiler | Version: 6.13
Keywords: | Difficulty:
Os: Unknown/Multiple | Testcase: simplCore/should_compile/T3831
Architecture: Unknown/Multiple | Failure: Compile-time performance bug
---------------------------------+------------------------------------------
Changes (by simonpj):
* testcase: => simplCore/should_compile/T3831
Comment:
I've fixed the blowup with
{{{
Mon Feb 1 00:24:20 GMT Standard Time 2010 [email protected]
* Fix Trac #3831: blowup in SpecConstr
It turned out that there were two bugs. First, we were getting an
exponential number of specialisations when we had a deep nest of
join points. See Note [Avoiding exponential blowup]. I fixed this
by dividing sc_count (in ScEnv) by the number of specialisations
when recursing. Crude but effective.
Second, when making specialisations I was looking at the result of
applying specExpr to the RHS of the function, whereas I should have
been looking at the original RHS. See Note [Specialise original
body].
There's a tantalising missed opportunity here, though. In this
example (recorded as a test simplCore/should_compile/T3831), each join
point has *exactly one* call pattern, so we should really just
specialise for that alone, in which case there's zero code-blow-up.
In particular, we don't need the *original* RHS at all. I need to think
more about how to exploit this.
But the blowup is now limited, so compiling terminfo with -O2 works
again.
}}}
I'm going to leave the ticket open because of the "tantalising
opportunity", but I'll retitle it.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3831#comment:2>
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