summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/cmm/CmmLayoutStack.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/cmm/CmmLayoutStack.hs b/compiler/cmm/CmmLayoutStack.hs
index 60f89704f0..fbd1d71cfb 100644
--- a/compiler/cmm/CmmLayoutStack.hs
+++ b/compiler/cmm/CmmLayoutStack.hs
@@ -528,8 +528,16 @@ makeFixupBlock dflags sp0 l stack tscope assigs
| otherwise = do
tmp_lbl <- newBlockId
let sp_off = sp0 - sm_sp stack
+ maybeAddUnwind block
+ | debugLevel dflags > 0
+ = block `blockSnoc` CmmUnwind [(Sp, unwind_val)]
+ | otherwise
+ = block
+ where unwind_val = cmmOffset dflags (CmmReg spReg) (sm_sp stack)
block = blockJoin (CmmEntry tmp_lbl tscope)
- (maybeAddSpAdj dflags sp_off (blockFromList assigs))
+ ( maybeAddSpAdj dflags sp_off
+ $ maybeAddUnwind
+ $ blockFromList assigs )
(CmmBranch l)
return (tmp_lbl, [block])