[project @ 2002-11-20 15:39:47 by simonpj] ------------------------------------ 	Improve occurrence analysis a little 	------------------------------------
[project @ 2002-11-20 15:39:47 by simonpj]
------------------------------------
	Improve occurrence analysis a little
	------------------------------------

Consider

		x1 = a0 : []
		x2 = a1 : x1
		x3 = a2 : x2
		g  = f x3

First time round, it looks as if x1 and x2 occur as an arg of a
let(rec)-bound constructor, and hence should not be inlined. (If the
RHS of a let is just (C a b) where C is a constructor, then we like to
keep it that way, with atomic a,b, so that it can be inlined easily at
a 'case'.)

But in this case, x3 is inlined in g's RHS... and now x2 is not an arg
of a let-bound constructor, so it can be inlined, and then x1.   Result:

		g = f (a2 : a1 : a0 : [])

Which is fine.  What is *not* fine is that it has been costing us a
whole simplifier iteration for each element!

This commit adds another little hack to get around the problem: don't treat
constructor RHSs specially if the bound variable looks as if it occurs just
once so it'll be inlined.  This catches the common case very nicely.

It's a pain that we have the atomic-args-for-constructor-RHSs invariant.
But I can't see  how to do without it.

sgillespie/ghc,gcampax/ghc,oldmanmike/ghc,frantisekfarka/ghc-dsi,ml9951/ghc,ml9951/ghc,ezyang/ghc,ryantm/ghc,oldmanmike/ghc,gridaphobe/ghc,nomeata/ghc,oldmanmike/ghc,GaloisInc/halvm-ghc,gcampax/ghc,hferreiro/replay,olsner/ghc,oldmanmike/ghc,forked-upstream-packages-for-ghcjs/ghc,nathyong/microghc-ghc,sdiehl/ghc,forked-upstream-packages-for-ghcjs/ghc,siddhanathan/ghc,nomeata/ghc,lukexi/ghc-7.8-arm64,urbanslug/ghc,hferreiro/replay,anton-dessiatov/ghc,christiaanb/ghc,olsner/ghc,jstolarek/ghc,shlevy/ghc,christiaanb/ghc,hferreiro/replay,snoyberg/ghc,tjakway/ghcjvm,vikraman/ghc,vTurbine/ghc,nkaretnikov/ghc,bitemyapp/ghc,fmthoma/ghc,sdiehl/ghc,lukexi/ghc,sgillespie/ghc,tjakway/ghcjvm,da-x/ghc,christiaanb/ghc,green-haskell/ghc,mcmaniac/ghc,AlexanderPankiv/ghc,mfine/ghc,holzensp/ghc,green-haskell/ghc,ghc-android/ghc,GaloisInc/halvm-ghc,tjakway/ghcjvm,ml9951/ghc,shlevy/ghc,wxwxwwxxx/ghc,frantisekfarka/ghc-dsi,ezyang/ghc,wxwxwwxxx/ghc,ekmett/ghc,da-x/ghc,mettekou/ghc,GaloisInc/halvm-ghc,elieux/ghc,ghc-android/ghc,urbanslug/ghc,gcampax/ghc,oldmanmike/ghc,vikraman/ghc,nkaretnikov/ghc,nathyong/microghc-ghc,sdiehl/ghc,mfine/ghc,gridaphobe/ghc,GaloisInc/halvm-ghc,elieux/ghc,green-haskell/ghc,bitemyapp/ghc,mfine/ghc,gridaphobe/ghc,holzensp/ghc,ezyang/ghc,tibbe/ghc,snoyberg/ghc,nathyong/microghc-ghc,ezyang/ghc,snoyberg/ghc,GaloisInc/halvm-ghc,snoyberg/ghc,da-x/ghc,mcmaniac/ghc,spacekitteh/smcghc,bitemyapp/ghc,forked-upstream-packages-for-ghcjs/ghc,olsner/ghc,hferreiro/replay,mcschroeder/ghc,lukexi/ghc,gcampax/ghc,mcschroeder/ghc,frantisekfarka/ghc-dsi,elieux/ghc,nushio3/ghc,mettekou/ghc,lukexi/ghc,urbanslug/ghc,anton-dessiatov/ghc,nkaretnikov/ghc,TomMD/ghc,wxwxwwxxx/ghc,elieux/ghc,christiaanb/ghc,tibbe/ghc,ml9951/ghc,siddhanathan/ghc,AlexanderPankiv/ghc,olsner/ghc,ghc-android/ghc,nomeata/ghc,bitemyapp/ghc,ghc-android/ghc,AlexanderPankiv/ghc,AlexanderPankiv/ghc,nathyong/microghc-ghc,mfine/ghc,ilyasergey/GHC-XAppFix,urbanslug/ghc,gridaphobe/ghc,christiaanb/ghc,mcschroeder/ghc,mcschroeder/ghc,wxwxwwxxx/ghc,ghc-android/ghc,wxwxwwxxx/ghc,oldmanmike/ghc,lukexi/ghc-7.8-arm64,bitemyapp/ghc,TomMD/ghc,oldmanmike/ghc,ekmett/ghc,mcmaniac/ghc,gridaphobe/ghc,gcampax/ghc,forked-upstream-packages-for-ghcjs/ghc,frantisekfarka/ghc-dsi,mcmaniac/ghc,nomeata/ghc,holzensp/ghc,acowley/ghc,lukexi/ghc-7.8-arm64,ezyang/ghc,mcschroeder/ghc,green-haskell/ghc,urbanslug/ghc,fmthoma/ghc,fmthoma/ghc,nkaretnikov/ghc,fmthoma/ghc,mcschroeder/ghc,elieux/ghc,ryantm/ghc,ekmett/ghc,vikraman/ghc,shlevy/ghc,acowley/ghc,sdiehl/ghc,TomMD/ghc,ml9951/ghc,fmthoma/ghc,tibbe/ghc,jstolarek/ghc,TomMD/ghc,tibbe/ghc,elieux/ghc,tjakway/ghcjvm,forked-upstream-packages-for-ghcjs/ghc,AlexanderPankiv/ghc,siddhanathan/ghc,jstolarek/ghc,hferreiro/replay,acowley/ghc,anton-dessiatov/ghc,urbanslug/ghc,vTurbine/ghc,snoyberg/ghc,nushio3/ghc,mettekou/ghc,nkaretnikov/ghc,sdiehl/ghc,nushio3/ghc,tjakway/ghcjvm,nathyong/microghc-ghc,tibbe/ghc,TomMD/ghc,nkaretnikov/ghc,olsner/ghc,ekmett/ghc,fmthoma/ghc,ryantm/ghc,vTurbine/ghc,siddhanathan/ghc,ilyasergey/GHC-XAppFix,tjakway/ghcjvm,anton-dessiatov/ghc,sdiehl/ghc,shlevy/ghc,snoyberg/ghc,ekmett/ghc,tjakway/ghcjvm,gcampax/ghc,holzensp/ghc,ryantm/ghc,AlexanderPankiv/ghc,da-x/ghc,acowley/ghc,sgillespie/ghc,lukexi/ghc-7.8-arm64,anton-dessiatov/ghc,sgillespie/ghc,nomeata/ghc,TomMD/ghc,nushio3/ghc,lukexi/ghc,wxwxwwxxx/ghc,da-x/ghc,nushio3/ghc,shlevy/ghc,forked-upstream-packages-for-ghcjs/ghc,nushio3/ghc,ml9951/ghc,forked-upstream-packages-for-ghcjs/ghc,ezyang/ghc,siddhanathan/ghc,GaloisInc/halvm-ghc,vikraman/ghc,mfine/ghc,da-x/ghc,shlevy/ghc,lukexi/ghc-7.8-arm64,ezyang/ghc,nathyong/microghc-ghc,sgillespie/ghc,TomMD/ghc,jstolarek/ghc,jstolarek/ghc,mettekou/ghc,mfine/ghc,wxwxwwxxx/ghc,acowley/ghc,siddhanathan/ghc,mfine/ghc,spacekitteh/smcghc,christiaanb/ghc,gridaphobe/ghc,shlevy/ghc,olsner/ghc,hferreiro/replay,christiaanb/ghc,mettekou/ghc,ilyasergey/GHC-XAppFix,mcschroeder/ghc,vTurbine/ghc,ryantm/ghc,ilyasergey/GHC-XAppFix,nathyong/microghc-ghc,green-haskell/ghc,mcmaniac/ghc,da-x/ghc,ghc-android/ghc,vikraman/ghc,lukexi/ghc,vikraman/ghc,gridaphobe/ghc,siddhanathan/ghc,spacekitteh/smcghc,spacekitteh/smcghc,anton-dessiatov/ghc,acowley/ghc,acowley/ghc,olsner/ghc,snoyberg/ghc,nushio3/ghc,sdiehl/ghc,hferreiro/replay,vTurbine/ghc,sgillespie/ghc,GaloisInc/halvm-ghc,AlexanderPankiv/ghc,vikraman/ghc,ml9951/ghc,spacekitteh/smcghc,vTurbine/ghc,frantisekfarka/ghc-dsi,nkaretnikov/ghc,sgillespie/ghc,elieux/ghc,mettekou/ghc,mettekou/ghc,anton-dessiatov/ghc,vTurbine/ghc,gcampax/ghc,urbanslug/ghc,ghc-android/ghc,holzensp/ghc,ml9951/ghc,fmthoma/ghc