Commit 12a92fed authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari

OccurAnal: Ensure SourceNotes don't interfere with join-point analysis

In general ticks are problematic for join point analysis as described
in #14242.  However, source notes are intended to be a best-effort
annotation which shouldn't interfere with optimization. Special-case
these to ensure that tail-call information is still correct, even in the
presence of source note
ticks.

Test Plan: Validate

Reviewers: simonpj, austin

Reviewed By: simonpj

Subscribers: rwbarton, thomie

GHC Trac Issues: #14242

Differential Revision: https://phabricator.haskell.org/D3978
parent 8b007abb
......@@ -1723,6 +1723,12 @@ we can sort them into the right place when doing dependency analysis.
-}
occAnal env (Tick tickish body)
| SourceNote{} <- tickish
= (usage, Tick tickish body')
-- SourceNotes are best-effort; so we just proceed as usual.
-- If we drop a tick due to the issues described below it's
-- not the end of the world.
| tickish `tickishScopesLike` SoftScope
= (markAllNonTailCalled usage, Tick tickish body')
......@@ -1742,6 +1748,7 @@ occAnal env (Tick tickish body)
-- Making j a join point may cause the simplifier to drop t
-- (if the tick is put into the continuation). So we don't
-- count j 1 as a tail call.
-- See #14242.
occAnal env (Cast expr co)
= case occAnal env expr of { (usage, expr') ->
......
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