
#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 simonmar): This is basically the same as #8905. It's not hard to rearrange the code to optimise the already-evaluated path, but as you noticed it will increase code size due to not being able to share the saving code with the heap-check failure, and having to reload things from the stack in the unevaluated case. Things are rather delicately arranged at the moment to generate small code. I believe the reason that you get some duplication when sinking the return address is because there's a special case in the stack allocator to spot this. One thing I think it would be worth doing is having an option to tune the tradeoff between code size and speed (like gcc's -Os), and the code generated for case expressions would be a prime candidate to be altered by this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10606#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler