Tidy up computation of result discounts in CoreUnfold
Tidy up computation of result discounts in CoreUnfold

Mostly this patch is a tidy-up, but it did reveal one inconsistency
that I fixed.  When computing result discounts for case expressions,
we were *adding* result-discounts for cases on non-arguments, but
*picking the one for the max-size branch* for arguments. I think you
could argue the toss, but it seems neater (and the code is nicer)
to be consistent (ie always add).  See Note [addAltSize result discounts].

The nofib results seem fine

        Program           Size    Allocs   Runtime   Elapsed
--------------------------------------------------------------------------------
          boyer          -0.8%     -4.8%      0.06      0.07
         sphere          -0.7%     -2.5%      0.15      0.16
--------------------------------------------------------------------------------
            Min          -0.8%     -4.8%    -19.1%    -24.8%
            Max          -0.5%     +0.0%     +3.4%   +127.1%
 Geometric Mean          -0.7%     -0.1%     -4.3%     -1.3%

The +127% elapsed is a timing error; I re-ran the same binary and it's
unchanged from the baseline.

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