Commit 9fddc216 authored by simonpj@microsoft.com's avatar simonpj@microsoft.com
Browse files

Remove debug warning, and explain why

parent 0cdde9d7
...@@ -817,7 +817,7 @@ tidyWorker _tidy_env _show_unfold NoWorker ...@@ -817,7 +817,7 @@ tidyWorker _tidy_env _show_unfold NoWorker
= NoWorker = NoWorker
tidyWorker tidy_env show_unfold (HasWorker work_id wrap_arity) tidyWorker tidy_env show_unfold (HasWorker work_id wrap_arity)
| show_unfold = HasWorker (tidyVarOcc tidy_env work_id) wrap_arity | show_unfold = HasWorker (tidyVarOcc tidy_env work_id) wrap_arity
| otherwise = WARN( True, ppr work_id ) NoWorker | otherwise = NoWorker
-- NB: do *not* expose the worker if show_unfold is off, -- NB: do *not* expose the worker if show_unfold is off,
-- because that means this thing is a loop breaker or -- because that means this thing is a loop breaker or
-- marked NOINLINE or something like that -- marked NOINLINE or something like that
...@@ -825,8 +825,12 @@ tidyWorker tidy_env show_unfold (HasWorker work_id wrap_arity) ...@@ -825,8 +825,12 @@ tidyWorker tidy_env show_unfold (HasWorker work_id wrap_arity)
-- then you can make the simplifier go into an infinite loop, because -- then you can make the simplifier go into an infinite loop, because
-- in effect the unfolding is exposed. See Trac #1709 -- in effect the unfolding is exposed. See Trac #1709
-- --
-- Mind you, it probably should not be w/w'd in the first place; -- You might think that if show_unfold is False, then the thing should
-- hence the WARN -- not be w/w'd in the first place. But a legitimate reason is this:
-- the function returns bottom
-- In this case, show_unfold will be false (we don't expose unfoldings
-- for bottoming functions), but we might still have a worker/wrapper
-- split (see Note [Worker-wrapper for bottoming functions] in WorkWrap.lhs
\end{code} \end{code}
%************************************************************************ %************************************************************************
......
...@@ -376,17 +376,7 @@ worthSplittingFun ds res ...@@ -376,17 +376,7 @@ worthSplittingFun ds res
= any worth_it ds || returnsCPR res = any worth_it ds || returnsCPR res
-- worthSplitting returns False for an empty list of demands, -- worthSplitting returns False for an empty list of demands,
-- and hence do_strict_ww is False if arity is zero and there is no CPR -- and hence do_strict_ww is False if arity is zero and there is no CPR
-- See Note [Worker-wrapper for bottoming functions]
-- We used not to split if the result is bottom.
-- [Justification: there's no efficiency to be gained.]
-- But it's sometimes bad not to make a wrapper. Consider
-- fw = \x# -> let x = I# x# in case e of
-- p1 -> error_fn x
-- p2 -> error_fn x
-- p3 -> the real stuff
-- The re-boxing code won't go away unless error_fn gets a wrapper too.
-- [We don't do reboxing now, but in general it's better to pass
-- an unboxed thing to f, and have it reboxed in the error cases....]
where where
worth_it Abs = True -- Absent arg worth_it Abs = True -- Absent arg
worth_it (Eval (Prod ds)) = True -- Product arg to evaluate worth_it (Eval (Prod ds)) = True -- Product arg to evaluate
...@@ -403,6 +393,19 @@ worthSplittingThunk maybe_dmd res ...@@ -403,6 +393,19 @@ worthSplittingThunk maybe_dmd res
worth_it other = False worth_it other = False
\end{code} \end{code}
Note [Worker-wrapper for bottoming functions]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We used not to split if the result is bottom.
[Justification: there's no efficiency to be gained.]
But it's sometimes bad not to make a wrapper. Consider
fw = \x# -> let x = I# x# in case e of
p1 -> error_fn x
p2 -> error_fn x
p3 -> the real stuff
The re-boxing code won't go away unless error_fn gets a wrapper too.
[We don't do reboxing now, but in general it's better to pass an
unboxed thing to f, and have it reboxed in the error cases....]
%************************************************************************ %************************************************************************
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment