+idRuleVars id = ASSERT( isId id)
+ specInfoFreeVars (idSpecialisation id) `unionVarSet`
+ idInlineFreeVars id -- And the variables in an INLINE rule
+
+idRuleRhsVars :: Id -> VarSet
+-- Just the variables free on the *rhs* of a rule
+-- See Note [Choosing loop breakers] in Simplify.lhs
+idRuleRhsVars id = foldr (unionVarSet . ruleRhsFreeVars)
+ (idInlineFreeVars id)
+ (idCoreRules id)
+
+idInlineFreeVars :: Id -> VarSet
+-- Produce free vars for an InlineRule, BUT NOT for an ordinary unfolding
+-- An InlineRule behaves *very like* a RULE, and that is what we are after here
+idInlineFreeVars id
+ = case idUnfolding id of
+ InlineRule { uf_tmpl = tmpl } -> exprFreeVars tmpl
+ _ -> emptyVarSet