Take account of loop breakers in specLookupRule
The key change is that in GHC.Core.Opt.Specialise.specLookupRule we were using realIdUnfolding, which ignores the loop-breaker flag. When given a loop breaker, rule matching therefore looped infinitely.
In fixing this I refactored a bit.
-
Define GHC.Core.InScopeEnv as a data type, and use it. (Previously it was a pair: hard to grep for.)
-
Put several functions returning an IdUnfoldingFun into GHC.Types.Id, namely
idUnfolding
alwaysActiveUnfoldingFun
whenActiveUnfoldingFun
-
noUnfoldingFun
and use them.
(The are all loop-breaker aware.)