
#11533: Stack check not optimized out even if it could be -------------------------------------+------------------------------------- Reporter: jscholl | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 (CodeGen) | Keywords: cmm | Operating System: Unknown/Multiple Architecture: | Type of failure: Runtime Unknown/Multiple | performance bug Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- CmmLayoutStack tries to remove a stack check if a function uses no stack space. It knows that Sp < SpLim is always false, but not that Sp >= SpLim is always true. However, the latter can arise when GHC flips the comparison (which it does sometimes). An example would be the worker function generated for {{{go}}}: {{{ countDown :: Int -> Int countDown = go 0 where go acc n | n > 0 = go (acc + 1) (n - 1) | otherwise = acc + n }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11533 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler