X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FcoreSyn%2FCoreFVs.lhs;h=90d76196495b8122587ea16a8390d28d3b67cd4a;hb=372a8c47e84ee0de43e9e03d5becb8276a4e148c;hp=f94f61d25ebd30ea2a1fd0578de933deb5b7a283;hpb=72462499b891d5779c19f3bda03f96e24f9554ae;p=ghc-hetmet.git diff --git a/compiler/coreSyn/CoreFVs.lhs b/compiler/coreSyn/CoreFVs.lhs index f94f61d..90d7619 100644 --- a/compiler/coreSyn/CoreFVs.lhs +++ b/compiler/coreSyn/CoreFVs.lhs @@ -395,7 +395,7 @@ idFreeVars id = ASSERT( isId id) bndrRuleAndUnfoldingVars ::Var -> VarSet -- A 'let' can bind a type variable, and idRuleVars assumes -- it's seeing an Id. This function tests first. -bndrRuleAndUnfoldingVars v | isTyVar v = emptyVarSet +bndrRuleAndUnfoldingVars v | isTyCoVar v = emptyVarSet | otherwise = idRuleAndUnfoldingVars v idRuleAndUnfoldingVars :: Id -> VarSet @@ -416,12 +416,16 @@ idRuleRhsVars id = foldr (unionVarSet . ruleRhsFreeVars) idUnfoldingVars :: Id -> VarSet -- Produce free vars for an unfolding, but NOT for an ordinary -- (non-inline) unfolding, since it is a dup of the rhs +-- and we'll get exponential behaviour if we look at both unf and rhs! +-- But do look at the *real* unfolding, even for loop breakers, else +-- we might get out-of-scope variables idUnfoldingVars id - = case idUnfolding id of - CoreUnfolding { uf_tmpl = rhs, uf_guidance = InlineRule {} } - -> exprFreeVars rhs - DFunUnfolding _ args -> exprsFreeVars args - _ -> emptyVarSet + = case realIdUnfolding id of + CoreUnfolding { uf_tmpl = rhs, uf_src = src } + | isStableSource src + -> exprFreeVars rhs + DFunUnfolding _ _ args -> exprsFreeVars args + _ -> emptyVarSet \end{code}