Commit fb9ae288 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Make FloatOut/SetLevels idemoptent on bottoming functions

This fixes Trac #13369.  It turned out that I really had got the
bottoming-float code wrong, again.  The new story is explained in
Note [Bottoming floats], esp item (3), and Note [Floating from a RHS].

I didn't make a regression test; it's hard to to so.

Nofib result are good

--------------------------------------------------------------------------------
        Program           Size    Allocs   Runtime   Elapsed  TotalMem
--------------------------------------------------------------------------------
         banner          -2.2%     -4.6%      0.00      0.00     +0.0%
           bspt          -1.3%     -1.6%      0.01      0.01     +0.0%
      cacheprof          -1.8%     -0.3%     +3.7%     +3.7%     -0.9%
   digits-of-e2          -1.0%     -1.5%     -0.5%     -0.5%     +0.0%
         expert          -1.3%     -0.2%      0.00      0.00     +0.0%
         n-body          -1.1%     -0.2%     +0.1%     +0.1%     +0.0%
        veritas          -2.9%     -0.1%      0.00      0.00     +0.0%
--------------------------------------------------------------------------------
            Min          -2.9%     -4.6%     -7.4%     -7.4%    -19.8%
            Max          -1.0%     +0.0%     +5.2%     +5.1%    +10.0%
 Geometric Mean          -1.2%     -0.1%     +0.5%     +0.5%     -0.1%

I /think/ all this is due to this error-floating change; but it's possible
that some was due to commit "Fix CSE (again) on literal strings" a couple
of commits earlier.
parent 995ab74b
This diff is collapsed.
==================== Tidy Core ====================
Result size of Tidy Core
= {terms: 73, types: 50, coercions: 0, joins: 0/0}
= {terms: 71, types: 44, coercions: 0, joins: 0/0}
Rec {
-- RHS size: {terms: 3, types: 4, coercions: 0, joins: 0/0}
T13143.$wf [InlPrag=NOINLINE] :: forall a. GHC.Prim.Void# -> a
[GblId, Arity=1, Str=<B,A>b]
T13143.$wf = \ (@ a) _ [Occ=Dead] -> lvl @ a
-- RHS size: {terms: 3, types: 3, coercions: 0, joins: 0/0}
lvl :: forall a. a
[GblId, Str=b]
lvl = \ (@ a) -> T13143.$wf @ a GHC.Prim.void#
-- RHS size: {terms: 4, types: 4, coercions: 0, joins: 0/0}
T13143.$wf [InlPrag=NOINLINE, Occ=LoopBreaker]
:: forall a. GHC.Prim.Void# -> a
[GblId, Arity=1, Caf=NoCafRefs, Str=<B,A>b]
T13143.$wf = \ (@ a) _ [Occ=Dead] -> T13143.$wf @ a GHC.Prim.void#
end Rec }
-- RHS size: {terms: 3, types: 4, coercions: 0, joins: 0/0}
-- RHS size: {terms: 4, types: 4, coercions: 0, joins: 0/0}
f [InlPrag=INLINE[0]] :: forall a. Int -> a
[GblId,
Arity=1,
Caf=NoCafRefs,
Str=<B,A>b,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)
Tmpl= \ (@ a) _ [Occ=Dead] -> T13143.$wf @ a GHC.Prim.void#}]
f = \ (@ a) _ [Occ=Dead] -> lvl @ a
f = \ (@ a) _ [Occ=Dead] -> T13143.$wf @ a GHC.Prim.void#
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
T13143.$trModule4 :: GHC.Prim.Addr#
......@@ -71,9 +68,9 @@ T13143.$trModule
= GHC.Types.Module T13143.$trModule3 T13143.$trModule1
-- RHS size: {terms: 2, types: 1, coercions: 0, joins: 0/0}
lvl1 :: Int
lvl :: Int
[GblId, Str=b]
lvl1 = T13143.$wf @ Int GHC.Prim.void#
lvl = T13143.$wf @ Int GHC.Prim.void#
Rec {
-- RHS size: {terms: 28, types: 7, coercions: 0, joins: 0/0}
......@@ -91,7 +88,7 @@ T13143.$wg
True ->
case w1 of {
False -> T13143.$wg GHC.Types.True GHC.Types.True ww;
True -> case lvl1 of wild2 { }
True -> case lvl of wild2 { }
}
}
end Rec }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment