Re: [GHC] #9434: GHC.List.reverse does not fuse

2014-08-15 Thread David Feuer
I'm having trouble when it doesn't fuse—it ends up with duplicate bindings at the top level, because build gets inlined n times, and the result lifted out. Nothing's *wrong* with the code, except that there are multiple copies of it. On Aug 15, 2014 10:58 AM, "GHC" wrote: > #9434: GHC.List.revers

Re: [GHC] #9434: GHC.List.reverse does not fuse

2014-08-15 Thread Dan Doel
Isn't this kind of thing fixed for other functions by rewriting back into the direct recursive definition if no fusion happens? On Fri, Aug 15, 2014 at 11:41 AM, David Feuer wrote: > I'm having trouble when it doesn't fuse—it ends up with duplicate bindings > at the top level, because build get

Re: [GHC] #9434: GHC.List.reverse does not fuse

2014-08-15 Thread David Feuer
Yes, but I'm not sure how to do that, especially because foldl doesn't have the phased NOINLINE that foldr does. On Aug 15, 2014 12:45 PM, "Dan Doel" wrote: > Isn't this kind of thing fixed for other functions by rewriting back into > the direct recursive definition if no fusion happens? > > > On

Re: [GHC] #9434: GHC.List.reverse does not fuse

2014-08-15 Thread Dan Doel
Make foldl's inline phased, and see what happens? Presumably the reason it doesn't have a phase limit yet is that it never participated in any fusion before, so there was never a reason to not just inline. Other than that it seems like: reverse xs => rewrite build (\c n -> foldl (n

RE: [GHC] #9434: GHC.List.reverse does not fuse

2014-08-17 Thread Simon Peyton Jones
; Simon Peyton Jones Subject: Re: [GHC] #9434: GHC.List.reverse does not fuse I'm having trouble when it doesn't fuse—it ends up with duplicate bindings at the top level, because build gets inlined n times, and the result lifted out. Nothing's *wrong* with the code, except that the

RE: [GHC] #9434: GHC.List.reverse does not fuse

2014-08-17 Thread David Feuer
plication in the first > place, than to create and try to CSE it away. Others have suggested ways > of doing so, following the pattern of existing RULES. > > > > Simon > > > > *From:* David Feuer [mailto:david.fe...@gmail.com] > *Sent:* 15 August 2014 16:41 >