<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Make foldl's inline phased, and see what happens?<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
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.<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
Other than that it seems like:<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">    reverse xs<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">      => rewrite<br>
</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">    build (\c n -> foldl (noinlineFlip c) n xs)<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">      => inline<br>
</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">    foldl (noinlineFlip (:)) [] xs<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">      => rewrite<br>
</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">    reverse xs<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">where I assume you need a special flip which may or may not exist in these modules already.<br>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 15, 2014 at 12:46 PM, David Feuer <span dir="ltr"><<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Yes, but I'm not sure how to do that, especially because foldl doesn't have the phased NOINLINE that foldr does.</p>
<div class="HOEnZb"><div class="h5">
<div class="gmail_quote">On Aug 15, 2014 12:45 PM, "Dan Doel" <<a href="mailto:dan.doel@gmail.com" target="_blank">dan.doel@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Isn't this kind of thing fixed for other functions by rewriting back into the direct recursive definition if no fusion happens?</div>


</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 15, 2014 at 11:41 AM, David Feuer <span dir="ltr"><<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">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.</p>




<div class="gmail_quote">On Aug 15, 2014 10:58 AM, "GHC" <<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



#9434: GHC.List.reverse does not fuse<br>
-------------------------------------+-------------------------------------<br>
              Reporter:  dfeuer      |            Owner:<br>
                  Type:  bug         |           Status:  new<br>
              Priority:  normal      |        Milestone:<br>
             Component:              |          Version:  7.9<br>
  libraries/base                     |         Keywords:<br>
            Resolution:              |     Architecture:  Unknown/Multiple<br>
      Operating System:              |       Difficulty:  Easy (less than 1<br>
  Unknown/Multiple                   |  hour)<br>
       Type of failure:  Runtime     |       Blocked By:<br>
  performance bug                    |  Related Tickets:<br>
             Test Case:              |<br>
              Blocking:              |<br>
Differential Revisions:              |<br>
-------------------------------------+-------------------------------------<br>
<br>
Comment (by simonpj):<br>
<br>
 Great.  Just check that when fusion ''doesn't'' take place, the result is<br>
 good. And do a `nofib` comparison for good luck. Then submit a patch.<br>
<br>
 Thanks for doing all this work on fusion, David.<br>
<br>
 Simon<span><font color="#888888"><br>
<br>
--<br>
Ticket URL: <<a href="http://ghc.haskell.org/trac/ghc/ticket/9434#comment:2" target="_blank">http://ghc.haskell.org/trac/ghc/ticket/9434#comment:2</a>><br>
GHC <<a href="http://www.haskell.org/ghc/" target="_blank">http://www.haskell.org/ghc/</a>><br>
The Glasgow Haskell Compiler<br>
</font></span></blockquote></div>
<br>_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/ghc-devs" target="_blank">http://www.haskell.org/mailman/listinfo/ghc-devs</a><br>
<br></blockquote></div><br></div>
</blockquote></div>
</div></div></blockquote></div><br></div>