summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2022-04-07 17:21:47 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-08-06 06:13:17 -0400
commitfab0ee93abda33bf5c7eb5ca0372e12bd140a252 (patch)
treedfb79e20a525328a52bd5ea9168583b836f9ab54 /testsuite
parent1f6c56ae9aa4ab4977ba376ac901d5256bf0aba0 (diff)
downloadhaskell-fab0ee93abda33bf5c7eb5ca0372e12bd140a252.tar.gz
Change `-fprof-late` to insert cost centres after unfolding creation.
The former behaviour of adding cost centres after optimization but before unfoldings are created is not available via the flag `prof-late-inline` instead. I also reduced the overhead of -fprof-late* by pushing the cost centres into lambdas. This means the cost centres will only account for execution of functions and not their partial application. Further I made LATE_CC cost centres it's own CC flavour so they now won't clash with user defined ones if a user uses the same string for a custom scc. LateCC: Don't put cost centres inside constructor workers. With -fprof-late they are rarely useful as the worker is usually inlined. Even if the worker is not inlined or we use -fprof-late-linline they are generally not helpful but bloat compile and run time significantly. So we just don't add sccs inside constructor workers. ------------------------- Metric Decrease: T13701 -------------------------
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/profiling/should_compile/all.T2
-rw-r--r--testsuite/tests/profiling/should_compile/prof-late-cc3.hs8
-rw-r--r--testsuite/tests/profiling/should_compile/prof-late-cc3.stderr50
-rw-r--r--testsuite/tests/profiling/should_compile/prof-late-cc4.hs5
-rw-r--r--testsuite/tests/profiling/should_compile/prof-late-cc4.stderr18
5 files changed, 83 insertions, 0 deletions
diff --git a/testsuite/tests/profiling/should_compile/all.T b/testsuite/tests/profiling/should_compile/all.T
index 9e460e153b..1f4ae1430d 100644
--- a/testsuite/tests/profiling/should_compile/all.T
+++ b/testsuite/tests/profiling/should_compile/all.T
@@ -4,6 +4,8 @@ test('prof001', [only_ways(['normal']), req_profiling], compile_and_run, ['-prof
test('prof002', [only_ways(['normal']), req_profiling], compile_and_run, ['-prof -fprof-cafs'])
test('prof-late-cc', [only_ways(['normal']), req_profiling], compile, ['-prof -fprof-late'])
test('prof-late-cc2', [only_ways(['normal']), req_profiling], compile_and_run, ['-prof -fprof-late'])
+test('prof-late-cc3', [only_ways(['normal']), req_profiling, grep_errmsg('scc')], compile, ['-prof -fprof-late -ddump-prep -ddump-simpl -dno-typeable-binds'])
+test('prof-late-cc4', [only_ways(['normal']), req_profiling, grep_errmsg('scc')], compile, ['-prof -fprof-late-inline -ddump-simpl -dno-typeable-binds -O'])
test('T2410', [only_ways(['normal']), req_profiling], compile, ['-O2 -prof -fprof-cafs'])
test('T5889', [only_ways(['normal']), req_profiling, extra_files(['T5889/A.hs', 'T5889/B.hs'])], multimod_compile, ['A B', '-O -prof -fno-prof-count-entries -v0'])
diff --git a/testsuite/tests/profiling/should_compile/prof-late-cc3.hs b/testsuite/tests/profiling/should_compile/prof-late-cc3.hs
new file mode 100644
index 0000000000..b7badbc216
--- /dev/null
+++ b/testsuite/tests/profiling/should_compile/prof-late-cc3.hs
@@ -0,0 +1,8 @@
+module M where
+
+-- There should be a cost center in core prep output but not in
+-- -ddump-simpl output with -fprof-late
+{-# INLINE doStuff #-}
+doStuff x = do
+ print x
+ return x
diff --git a/testsuite/tests/profiling/should_compile/prof-late-cc3.stderr b/testsuite/tests/profiling/should_compile/prof-late-cc3.stderr
new file mode 100644
index 0000000000..92d9b1cd8f
--- /dev/null
+++ b/testsuite/tests/profiling/should_compile/prof-late-cc3.stderr
@@ -0,0 +1,50 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core
+ = {terms: 12, types: 16, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 11, types: 10, coercions: 0, joins: 0/0}
+doStuff [InlPrag=INLINE (sat-args=1)]
+ :: forall {b}. Show b => b -> IO b
+[GblId, Arity=2, Unf=OtherCon []]
+doStuff
+ = \ (@b_axP) ($dShow_aET :: Show b_axP) (eta_B0 :: b_axP) ->
+ >>
+ @IO
+ GHC.Base.$fMonadIO
+ @()
+ @b_axP
+ (print @b_axP $dShow_aET eta_B0)
+ (return @IO GHC.Base.$fMonadIO @b_axP eta_B0)
+
+
+
+
+==================== CorePrep ====================
+Result size of CorePrep
+ = {terms: 16, types: 20, coercions: 0, joins: 0/2}
+
+-- RHS size: {terms: 15, types: 14, coercions: 0, joins: 0/2}
+M.doStuff [InlPrag=INLINE (sat-args=1)]
+ :: forall {b}. GHC.Show.Show b => b -> GHC.Types.IO b
+[GblId, Arity=2, Unf=OtherCon []]
+M.doStuff
+ = \ (@b_axP)
+ ($dShow_sJs [Occ=OnceL1] :: GHC.Show.Show b_axP)
+ (eta_sJt :: b_axP) ->
+ scctick<doStuff>
+ let {
+ sat_sJv [Occ=Once1] :: GHC.Types.IO b_axP
+ [LclId]
+ sat_sJv
+ = GHC.Base.return
+ @GHC.Types.IO GHC.Base.$fMonadIO @b_axP eta_sJt } in
+ let {
+ sat_sJu [Occ=Once1] :: GHC.Types.IO ()
+ [LclId]
+ sat_sJu = System.IO.print @b_axP $dShow_sJs eta_sJt } in
+ GHC.Base.>>
+ @GHC.Types.IO GHC.Base.$fMonadIO @() @b_axP sat_sJu sat_sJv
+
+
+
diff --git a/testsuite/tests/profiling/should_compile/prof-late-cc4.hs b/testsuite/tests/profiling/should_compile/prof-late-cc4.hs
new file mode 100644
index 0000000000..45d628cd0f
--- /dev/null
+++ b/testsuite/tests/profiling/should_compile/prof-late-cc4.hs
@@ -0,0 +1,5 @@
+module M where
+
+-- There should be a cost center in the -ddump-simpl output
+addStuff x y = do
+ x + y :: Int
diff --git a/testsuite/tests/profiling/should_compile/prof-late-cc4.stderr b/testsuite/tests/profiling/should_compile/prof-late-cc4.stderr
new file mode 100644
index 0000000000..2de7dad615
--- /dev/null
+++ b/testsuite/tests/profiling/should_compile/prof-late-cc4.stderr
@@ -0,0 +1,18 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core
+ = {terms: 2, types: 3, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+addStuff [InlPrag=INLINE (sat-args=2)] :: Int -> Int -> Int
+[GblId,
+ Str=<1!P(L)><1!P(L)>,
+ Cpr=1,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True,
+ Guidance=ALWAYS_IF(arity=2,unsat_ok=False,boring_ok=True)
+ Tmpl= GHC.Num.$fNumInt_$c+}]
+addStuff = scctick<addStuff> GHC.Num.$fNumInt_$c+
+
+
+