
#11372: Loopification does not trigger for IO even if it could -------------------------------------+------------------------------------- Reporter: jscholl | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 (CodeGen) | Keywords: cmm, Resolution: | loopification, code generation Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1767 Wiki Page: | -------------------------------------+------------------------------------- Changes (by jscholl): * status: new => patch * differential: => Phab:D1767 Comment: The problem with loopification for loops in {{{IO}}} / any monad of the form {{{State# s -> (# State s, a #)}}} is indeed caused by the extra {{{State#}}} tokens. While they have no runtime representation and thus are not passed to a self-recursive call, they are still counted as arguments when considering a self-recursive call for loopification. So I tried to fix this by adding an additional parameter to {{{getCallMethod}}}, namely the number of void arguments, and subtract that number before checking if the correct number of arguments is present (I could not just remove void arguments from the arguments as the number of arguments is used in other places as well and I think there these void arguments have to generate {{{stg_ap_v}}} calls or something similar). I also tried to add a note describing the situation with these void arguments and loopification. I also did a nofib-run. Most things changed only a little bit, but most of the code seems to run a little bit faster, though in praxis it is even less than in my benchmark, but this is not suprising as most code does not (only) consist of such loops in IO. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11372#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler