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 go
:
countDown :: Int -> Int
countDown = go 0
where
go acc n | n > 0 = go (acc + 1) (n - 1)
| otherwise = acc + n
Trac metadata
Trac field | Value |
---|---|
Version | 7.10.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (CodeGen) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |