diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2014-05-08 11:21:16 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2014-08-28 11:14:05 +0100 |
commit | 6e0f6ededff6018a88dd390590a09f79842ccfa5 (patch) | |
tree | c2d4f46cfdcf8b236d9ac751c48f0b0ccced7503 /testsuite | |
parent | e9cd1d5e9d6f0e019d6433a3c7dd9585b3f7ae6b (diff) | |
download | haskell-6e0f6ededff6018a88dd390590a09f79842ccfa5.tar.gz |
Refactor unfoldings
There are two main refactorings here
1. Move the uf_arity field
out of CoreUnfolding
into UnfWhen
It's a lot tidier there. If I've got this right, no behaviour
should change.
2. Define specUnfolding and use it in DsBinds and Specialise
a) commons-up some shared code
b) makes sure that Specialise correctly specialises DFun
unfoldings (which it didn't before)
The two got put together because both ended up interacting in the
specialiser.
They cause zero difference to nofib.
Diffstat (limited to 'testsuite')
11 files changed, 57 insertions, 61 deletions
diff --git a/testsuite/tests/deSugar/should_compile/T2431.stderr b/testsuite/tests/deSugar/should_compile/T2431.stderr index c40b603d3f..f9b07605b9 100644 --- a/testsuite/tests/deSugar/should_compile/T2431.stderr +++ b/testsuite/tests/deSugar/should_compile/T2431.stderr @@ -6,9 +6,9 @@ T2431.$WRefl [InlPrag=INLINE] :: forall a. a T2431.:~: a [GblId[DataConWrapper], Caf=NoCafRefs, Str=DmdType, - Unf=Unf{Src=InlineStable, TopLvl=True, Arity=0, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=ALWAYS_IF(unsat_ok=False,boring_ok=False) + Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=0,unsat_ok=False,boring_ok=False) Tmpl= \ (@ a) -> T2431.Refl @ a @ a @~ <a>_N}] T2431.$WRefl = \ (@ a) -> T2431.Refl @ a @ a @~ <a>_N diff --git a/testsuite/tests/numeric/should_compile/T7116.stdout b/testsuite/tests/numeric/should_compile/T7116.stdout index 549ed488aa..9e5d19e3e0 100644 --- a/testsuite/tests/numeric/should_compile/T7116.stdout +++ b/testsuite/tests/numeric/should_compile/T7116.stdout @@ -7,9 +7,9 @@ T7116.dl :: GHC.Types.Double -> GHC.Types.Double Arity=1, Caf=NoCafRefs, Str=DmdType <S,1*U(U)>m, - Unf=Unf{Src=InlineStable, TopLvl=True, Arity=1, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False) + Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (x [Occ=Once!] :: GHC.Types.Double) -> case x of _ [Occ=Dead] { GHC.Types.D# y -> GHC.Types.D# (GHC.Prim.+## y y) @@ -25,9 +25,9 @@ T7116.dr :: GHC.Types.Double -> GHC.Types.Double Arity=1, Caf=NoCafRefs, Str=DmdType <S,1*U(U)>m, - Unf=Unf{Src=InlineStable, TopLvl=True, Arity=1, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False) + Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (x [Occ=Once!] :: GHC.Types.Double) -> case x of _ [Occ=Dead] { GHC.Types.D# x1 -> GHC.Types.D# (GHC.Prim.+## x1 x1) @@ -39,9 +39,9 @@ T7116.fl :: GHC.Types.Float -> GHC.Types.Float Arity=1, Caf=NoCafRefs, Str=DmdType <S,1*U(U)>m, - Unf=Unf{Src=InlineStable, TopLvl=True, Arity=1, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False) + Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (x [Occ=Once!] :: GHC.Types.Float) -> case x of _ [Occ=Dead] { GHC.Types.F# y -> GHC.Types.F# (GHC.Prim.plusFloat# y y) @@ -57,9 +57,9 @@ T7116.fr :: GHC.Types.Float -> GHC.Types.Float Arity=1, Caf=NoCafRefs, Str=DmdType <S,1*U(U)>m, - Unf=Unf{Src=InlineStable, TopLvl=True, Arity=1, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False) + Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (x [Occ=Once!] :: GHC.Types.Float) -> case x of _ [Occ=Dead] { GHC.Types.F# x1 -> GHC.Types.F# (GHC.Prim.plusFloat# x1 x1) diff --git a/testsuite/tests/simplCore/should_compile/T3717.stderr b/testsuite/tests/simplCore/should_compile/T3717.stderr index 4522fb5d91..73b73effb9 100644 --- a/testsuite/tests/simplCore/should_compile/T3717.stderr +++ b/testsuite/tests/simplCore/should_compile/T3717.stderr @@ -18,9 +18,9 @@ T3717.foo [InlPrag=INLINE[0]] :: GHC.Types.Int -> GHC.Types.Int Arity=1, Caf=NoCafRefs, Str=DmdType <S(S),1*U(1*U)>m, - Unf=Unf{Src=InlineStable, TopLvl=True, Arity=1, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False) + Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (w [Occ=Once!] :: GHC.Types.Int) -> case w of _ [Occ=Dead] { GHC.Types.I# ww1 [Occ=Once] -> case T3717.$wfoo ww1 of ww2 { __DEFAULT -> GHC.Types.I# ww2 } diff --git a/testsuite/tests/simplCore/should_compile/T4908.stderr b/testsuite/tests/simplCore/should_compile/T4908.stderr index 3acef2fefd..2f80625e98 100644 --- a/testsuite/tests/simplCore/should_compile/T4908.stderr +++ b/testsuite/tests/simplCore/should_compile/T4908.stderr @@ -28,9 +28,8 @@ T4908.$wf Arity=2, Caf=NoCafRefs, Str=DmdType <S,1*U><L,1*U(A,U(U))>, - Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=2, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=IF_ARGS [30 20] 101 20}] + Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [30 20] 101 20}] T4908.$wf = \ (ww :: GHC.Prim.Int#) (w :: (GHC.Types.Int, GHC.Types.Int)) -> case ww of ds { @@ -53,9 +52,9 @@ T4908.f [InlPrag=INLINE[0]] Arity=2, Caf=NoCafRefs, Str=DmdType <S(S),1*U(1*U)><L,1*U(A,U(U))>, - Unf=Unf{Src=InlineStable, TopLvl=True, Arity=2, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False) + Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=False) Tmpl= \ (w [Occ=Once!] :: GHC.Types.Int) (w1 [Occ=Once] :: (GHC.Types.Int, GHC.Types.Int)) -> case w of _ [Occ=Dead] { GHC.Types.I# ww1 [Occ=Once] -> diff --git a/testsuite/tests/simplCore/should_compile/T4930.stderr b/testsuite/tests/simplCore/should_compile/T4930.stderr index 9570b7b98a..5f0aad2525 100644 --- a/testsuite/tests/simplCore/should_compile/T4930.stderr +++ b/testsuite/tests/simplCore/should_compile/T4930.stderr @@ -14,9 +14,9 @@ T4930.foo :: GHC.Types.Int -> GHC.Types.Int [GblId, Arity=1, Str=DmdType <S,1*U(U)>m, - Unf=Unf{Src=InlineStable, TopLvl=True, Arity=1, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False) + Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (n [Occ=Once!] :: GHC.Types.Int) -> case n of _ [Occ=Dead] { GHC.Types.I# x -> case GHC.Prim.tagToEnum# @ GHC.Types.Bool (GHC.Prim.<# x 5) diff --git a/testsuite/tests/simplCore/should_compile/T7360.stderr b/testsuite/tests/simplCore/should_compile/T7360.stderr index 9a5896a8d4..c6c0563cac 100644 --- a/testsuite/tests/simplCore/should_compile/T7360.stderr +++ b/testsuite/tests/simplCore/should_compile/T7360.stderr @@ -7,9 +7,9 @@ T7360.$WFoo3 [InlPrag=INLINE] :: GHC.Types.Int -> T7360.Foo Arity=1, Caf=NoCafRefs, Str=DmdType <S,U>m3, - Unf=Unf{Src=InlineStable, TopLvl=True, Arity=1, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=ALWAYS_IF(unsat_ok=False,boring_ok=False) + Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=1,unsat_ok=False,boring_ok=False) Tmpl= \ (dt [Occ=Once!] :: GHC.Types.Int) -> case dt of _ [Occ=Dead] { GHC.Types.I# dt [Occ=Once] -> T7360.Foo3 dt @@ -29,27 +29,25 @@ T7360.fun1 = T7360.fun4 :: () [GblId, Str=DmdType, - Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=False, - ConLike=False, WorkFree=False, Expandable=False, - Guidance=IF_ARGS [] 20 0}] + Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False, + WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 20 0}] T7360.fun4 = T7360.fun1 T7360.Foo1 T7360.fun3 :: GHC.Types.Int [GblId, Caf=NoCafRefs, Str=DmdType m, - Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=IF_ARGS [] 10 20}] + Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}] T7360.fun3 = GHC.Types.I# 0 T7360.fun2 :: forall a. [a] -> ((), GHC.Types.Int) [GblId, Arity=1, Str=DmdType <L,1*U>m, - Unf=Unf{Src=InlineStable, TopLvl=True, Arity=1, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False) + Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (@ a) (x [Occ=Once!] :: [a]) -> (T7360.fun4, case x of wild { diff --git a/testsuite/tests/simplCore/should_compile/T7785.stderr b/testsuite/tests/simplCore/should_compile/T7785.stderr index d32eacce48..c80738f4c3 100644 --- a/testsuite/tests/simplCore/should_compile/T7785.stderr +++ b/testsuite/tests/simplCore/should_compile/T7785.stderr @@ -1,6 +1,6 @@ ==================== Tidy Core rules ==================== -"SPEC Foo.shared [[]]" [ALWAYS] +"SPEC Foo.shared @ []" [ALWAYS] forall ($dMyFunctor :: MyFunctor []) (irred :: Domain [] Int). shared @ [] $dMyFunctor irred = bar_$sshared diff --git a/testsuite/tests/simplCore/should_compile/T8848.stderr b/testsuite/tests/simplCore/should_compile/T8848.stderr index ed815141b5..c17d5994c1 100644 --- a/testsuite/tests/simplCore/should_compile/T8848.stderr +++ b/testsuite/tests/simplCore/should_compile/T8848.stderr @@ -14,4 +14,6 @@ Rule fired: Class op <*> Rule fired: Class op $p1Applicative Rule fired: Class op fmap Rule fired: Class op <*> -Rule fired: SPEC T8848.$fFunctorShape ['T8848.Z] +Rule fired: SPEC $cfmap @ 'T8848.Z +Rule fired: SPEC $c<$ @ 'T8848.Z +Rule fired: SPEC T8848.$fFunctorShape @ 'T8848.Z diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index c4c32ccd8b..d8518f6264 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -202,6 +202,6 @@ test('T8832', run_command, ['$MAKE -s --no-print-directory T8832 T8832_WORDSIZE_OPTS=' + ('-DT8832_WORDSIZE_64' if wordsize(64) else '')]) -test('T8848', only_ways(['optasm']), compile, ['-ddump-rule-firings']) +test('T8848', only_ways(['optasm']), compile, ['-ddump-rule-firings -dsuppress-uniques']) test('T8848a', only_ways(['optasm']), compile, ['-ddump-rules']) test('T8331', only_ways(['optasm']), compile, ['-ddump-rules']) diff --git a/testsuite/tests/simplCore/should_compile/spec-inline.stderr b/testsuite/tests/simplCore/should_compile/spec-inline.stderr index 869017653f..4b48ee3e8d 100644 --- a/testsuite/tests/simplCore/should_compile/spec-inline.stderr +++ b/testsuite/tests/simplCore/should_compile/spec-inline.stderr @@ -48,9 +48,8 @@ Roman.$wgo [GblId, Arity=2, Str=DmdType <S,1*U><S,1*U>, - Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=2, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=IF_ARGS [60 30] 256 0}] + Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [60 30] 256 0}] Roman.$wgo = \ (w :: Data.Maybe.Maybe GHC.Types.Int) (w1 :: Data.Maybe.Maybe GHC.Types.Int) -> @@ -99,9 +98,9 @@ Roman.foo_go [InlPrag=INLINE[0]] [GblId, Arity=2, Str=DmdType <S,1*U><S,1*U>m, - Unf=Unf{Src=InlineStable, TopLvl=True, Arity=2, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False) + Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=False) Tmpl= \ (w [Occ=Once] :: Data.Maybe.Maybe GHC.Types.Int) (w1 [Occ=Once] :: Data.Maybe.Maybe GHC.Types.Int) -> case Roman.$wgo w w1 of ww { __DEFAULT -> GHC.Types.I# ww }}] @@ -114,18 +113,16 @@ Roman.foo2 :: GHC.Types.Int [GblId, Caf=NoCafRefs, Str=DmdType m, - Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=IF_ARGS [] 10 20}] + Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}] Roman.foo2 = GHC.Types.I# 6 Roman.foo1 :: Data.Maybe.Maybe GHC.Types.Int [GblId, Caf=NoCafRefs, Str=DmdType m2, - Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=IF_ARGS [] 10 20}] + Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}] Roman.foo1 = Data.Maybe.Just @ GHC.Types.Int Roman.foo2 Roman.foo :: GHC.Types.Int -> GHC.Types.Int @@ -133,9 +130,9 @@ Roman.foo :: GHC.Types.Int -> GHC.Types.Int Arity=1, Caf=NoCafRefs, Str=DmdType <S,1*U>m, - Unf=Unf{Src=InlineStable, TopLvl=True, Arity=1, Value=True, - ConLike=True, WorkFree=True, Expandable=True, - Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False) + Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (n [Occ=Once!] :: GHC.Types.Int) -> case n of n1 { GHC.Types.I# _ [Occ=Dead] -> Roman.foo_go (Data.Maybe.Just @ GHC.Types.Int n1) Roman.foo1 diff --git a/testsuite/tests/simplCore/should_run/T2486.stderr b/testsuite/tests/simplCore/should_run/T2486.stderr index c85297c5cb..52f5533673 100644 --- a/testsuite/tests/simplCore/should_run/T2486.stderr +++ b/testsuite/tests/simplCore/should_run/T2486.stderr @@ -1,18 +1,18 @@ ==================== Tidy Core rules ==================== -"SPEC Main.fib [GHC.Types.Double]" [ALWAYS] +"SPEC Main.fib @ GHC.Types.Double" [ALWAYS] forall ($dNum :: Num Double) ($dOrd :: Ord Double). fib @ Double $dNum $dOrd = fib_$sfib1 -"SPEC Main.fib [GHC.Types.Int]" [ALWAYS] +"SPEC Main.fib @ GHC.Types.Int" [ALWAYS] forall ($dNum :: Num Int) ($dOrd :: Ord Int). fib @ Int $dNum $dOrd = fib_$sfib -"SPEC Main.tak [GHC.Types.Double]" [ALWAYS] +"SPEC Main.tak @ GHC.Types.Double" [ALWAYS] forall ($dNum :: Num Double) ($dOrd :: Ord Double). tak @ Double $dNum $dOrd = tak_$stak1 -"SPEC Main.tak [GHC.Types.Int]" [ALWAYS] +"SPEC Main.tak @ GHC.Types.Int" [ALWAYS] forall ($dNum :: Num Int) ($dOrd :: Ord Int). tak @ Int $dNum $dOrd = tak_$stak |