Stack check not optimized out even if it could be
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
countDown :: Int -> Int countDown = go 0 where go acc n | n > 0 = go (acc + 1) (n - 1) | otherwise = acc + n