
#10844: CallStack should not be inlined -------------------------------------+------------------------------------- Reporter: nomeata | Owner: gridaphobe Type: task | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1259 Wiki Page: | -------------------------------------+------------------------------------- Comment (by gridaphobe): Actually, that's not the problem (though it may well be a profitable change regardless). The problem can be illustrated even more simply. {{{ module Foo where str = "foo" ++ "\n" ++ "\n" }}} We would like GHC to optimize this into {{{ str = "foo\n\n" }}} but the pre-emptive lifting/cse that I've done during desugaring gives us {{{ foo = "foo" n = "\n" str = foo ++ n ++ n }}} At this point the simplifier is in a bind because in order to fully inline everything, it would have to '''duplicate''' the `"\n"` string, and GHC presumably knows this is generally a bad idea. Removing the pre-emptive CSE from the desugarer resolves this issue :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10844#comment:23 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler