Loop unrolling + fusion ?

Claus Reinke claus.reinke at talk21.com
Mon Mar 9 09:18:32 EDT 2009

>> let f = ..f.. in f{n,m} -PEEL-> let f = ..f.. in ..f{n-1,m}..

>Probably what you intend here is that you create one copy of the
>definition every round rather than one per call site, is that right?

I don't think so - ultimately, the point of both peeling and unrolling 
is to unfold a definition into a use site, to enable further optimizations, 
not just to move from a recursive to a non-recursive definition. We 
could try to do it in two steps, as you suggest, but that would expose 
us to the heuristics of GHC inlining again (will or won't it inline the
new shared definition?), in the middle of a user-annotation-based 

As for the remainder of your useful reply, I'll have to think more
about how to make a local-rule-based approach work properly
(without the hickups of my first sketch) before I can think about
the interactions. I still think it would be useful to have such a
rule-based description, even if a monolithic core2core pass may
be easier to implement: having two independent specs makes it
easier to spot inconsistencies, and if the rule-based form doesn't
get too complicated, it should be more suited for documentation.


More information about the Glasgow-haskell-users mailing list