summaryrefslogtreecommitdiff
path: root/compiler/simplCore
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2020-02-06 15:11:21 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-02-20 21:56:15 -0500
commit6de966f1369740d00193e64ec82d11e934256616 (patch)
treed96c7d9656b7019d743066c7b0d0e8f4d2cffc64 /compiler/simplCore
parent04eb0d6c4de23a4cfe3953e7496f5bc4b5b1d53c (diff)
downloadhaskell-6de966f1369740d00193e64ec82d11e934256616.tar.gz
Fix #17724 by having occAnal preserve used bindings.
It sometimes happened that occAnal would remove bindings as dead code by relying on bindings to be in dependency order. The fix was contributed by SPJ.
Diffstat (limited to 'compiler/simplCore')
-rw-r--r--compiler/simplCore/OccurAnal.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs
index 96ee9623c3..47460178f1 100644
--- a/compiler/simplCore/OccurAnal.hs
+++ b/compiler/simplCore/OccurAnal.hs
@@ -81,11 +81,16 @@ occurAnalysePgm this_mod active_unf active_rule imp_rules binds
(final_usage, occ_anald_binds) = go init_env binds
(_, occ_anald_glommed_binds) = occAnalRecBind init_env TopLevel
imp_rule_edges
- (flattenBinds occ_anald_binds)
+ (flattenBinds binds)
initial_uds
-- It's crucial to re-analyse the glommed-together bindings
-- so that we establish the right loop breakers. Otherwise
-- we can easily create an infinite loop (#9583 is an example)
+ --
+ -- Also crucial to re-analyse the /original/ bindings
+ -- in case the first pass accidentally discarded as dead code
+ -- a binding that was actually needed (albeit before its
+ -- definition site). #17724 threw this up.
initial_uds = addManyOccsSet emptyDetails
(rulesFreeVars imp_rules)