
#10606: avoid redundant stores to the stack when examining already-tagged data -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 (CodeGen) | Keywords: Resolution: | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: Runtime | Test Case: performance bug | Blocking: Blocked By: | Differential Revisions: Related Tickets: | -------------------------------------+------------------------------------- Comment (by simonpj): Moreover, the code for each alternative has to work regardless of whether we arrive at it by doing an eval-and-return, or just jump to it for the fully-tagged case. So the code for the alternative needs to know where t,f are going to be. You say that you can use them "wherever they are", and that may be true if they are in local variables (= registers). But then the return-from-eval code will need to re-load them from the stack into the agreed registers, before going to the shared code for the alternative. And that could be bad if the first thing the alternative does is to save them on the stack for another eval! Morover, an unboxed-tuple-return might use up a bunch of registers. This looks tricky to me. Happy to Skype about it if you are keen to pursue. But I think there is lower-hanging fruit: see "Cmm and code generation" on [wiki:Status/SLPJ-Tickets]. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10606#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler