Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Alex D
GHC
Commits
20b1a077
Commit
20b1a077
authored
Jan 17, 2014
by
Joachim Breitner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add testcase for #4267
parent
19e09df4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
0 deletions
+72
-0
testsuite/tests/perf/should_run/T4267.hs
testsuite/tests/perf/should_run/T4267.hs
+64
-0
testsuite/tests/perf/should_run/all.T
testsuite/tests/perf/should_run/all.T
+8
-0
No files found.
testsuite/tests/perf/should_run/T4267.hs
0 → 100644
View file @
20b1a077
data
Tree
a
=
Leaf
|
Node
a
!
(
Tree
a
)
!
(
Tree
a
)
{-
This should produce a walker with unboxed integers.
Bad:
Rec {
go_r1us
:: GHC.Types.Int -> Main.Tree GHC.Types.Int -> GHC.Types.Int
[GblId, Arity=2, Caf=NoCafRefs, Str=DmdType SS]
go_r1us =
\ (z_aeS :: GHC.Types.Int) (ds_dmD :: Main.Tree GHC.Types.Int) ->
case ds_dmD of _ {
Main.Leaf -> z_aeS;
Main.Node a1_aeU l_aeV r_aeW ->
case go_r1us z_aeS l_aeV of _ { GHC.Types.I# ipv_snn ->
case a1_aeU of _ { GHC.Types.I# y_anh ->
go_r1us (GHC.Types.I# (GHC.Prim.+# ipv_snn y_anh)) r_aeW
}
}
}
end Rec }
Good:
Rec {
$wgo_r2fS
:: GHC.Prim.Int# -> Main.Tree GHC.Types.Int -> GHC.Prim.Int#
[GblId, Arity=2, Caf=NoCafRefs, Str=DmdType <L,U><S,1*U>]
$wgo_r2fS =
\ (ww_s2eZ :: GHC.Prim.Int#) (w_s2eW :: Main.Tree GHC.Types.Int) ->
case w_s2eW of _ [Occ=Dead] {
Main.Leaf -> ww_s2eZ;
Main.Node a1_aqv l_aqw r_aqx ->
case $wgo_r2fS ww_s2eZ l_aqw of ww1_s2f3 { __DEFAULT ->
case a1_aqv of _ [Occ=Dead] { GHC.Types.I# y_aTz ->
$wgo_r2fS (GHC.Prim.+# ww1_s2f3 y_aTz) r_aqx
}
}
}
end Rec }
-}
-- Strict, pre-order fold.
fold'
::
(
a
->
b
->
a
)
->
a
->
Tree
b
->
a
fold'
f
=
go
where
go
z
Leaf
=
z
go
z
(
Node
a
l
r
)
=
let
z'
=
go
z
l
z''
=
f
z'
a
in
z'
`
seq
`
z''
`
seq
`
go
z''
r
sumTree
::
Int
->
Tree
Int
->
Int
sumTree
=
fold'
(
+
)
tree
=
Node
0
(
Node
0
Leaf
Leaf
)
(
Node
0
Leaf
Leaf
)
main
=
sum
[
sumTree
n
tree
|
n
<-
[
0
..
1000
]]
`
seq
`
return
()
testsuite/tests/perf/should_run/all.T
View file @
20b1a077
...
...
@@ -306,3 +306,11 @@ test('T5949',
compile_and_run
,
['
-O
'])
test
('
T4267
',
[
stats_num_field
('
bytes allocated
',
[
(
wordsize
(
64
),
130000
,
10
)]),
# previously, it was >170000 bytes
only_ways
(['
normal
'])],
compile_and_run
,
['
-O
'])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment