summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2022-07-18 16:14:16 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-07-25 14:38:14 -0400
commitd4fe2f4e01e414e78f8f4d9c626e8babfdf5bf48 (patch)
tree4329b7d5f0c5de6edaef915f10dda07ea6196641 /testsuite
parent5d26c321ae494db1b1cf725af3e002d344886951 (diff)
downloadhaskell-d4fe2f4e01e414e78f8f4d9c626e8babfdf5bf48.tar.gz
Teach SpecConstr about typeDeterminesValue
This patch addresses #21831, point 2. See Note [generaliseDictPats] in SpecConstr I took the opportunity to refactor the construction of specialisation rules a bit, so that the rule name says what type we are specialising at. Surprisingly, there's a 20% decrease in compile time for test perf/compiler/T18223. I took a look at it, and the code size seems the same throughout. I did a quick ticky profile which seemed to show a bit less substitution going on. Hmm. Maybe it's the "don't do eta-expansion in stable unfoldings" patch, which is part of the same MR as this patch. Anyway, since it's a move in the right direction, I didn't think it was worth looking into further. Metric Decrease: T18223
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/perf/compiler/T4007.stdout2
-rw-r--r--testsuite/tests/simplCore/should_compile/T15445.stderr6
-rw-r--r--testsuite/tests/simplCore/should_compile/T19246.stderr2
-rw-r--r--testsuite/tests/simplCore/should_compile/T8331.stderr2
-rw-r--r--testsuite/tests/simplCore/should_compile/T8848.stdout4
-rw-r--r--testsuite/tests/simplCore/should_compile/T8848a.stderr2
-rw-r--r--testsuite/tests/simplCore/should_compile/spec004.stderr18
7 files changed, 18 insertions, 18 deletions
diff --git a/testsuite/tests/perf/compiler/T4007.stdout b/testsuite/tests/perf/compiler/T4007.stdout
index fc69f2c1c3..1d64fc106d 100644
--- a/testsuite/tests/perf/compiler/T4007.stdout
+++ b/testsuite/tests/perf/compiler/T4007.stdout
@@ -3,7 +3,7 @@ Rule fired: Class op return (BUILTIN)
Rule fired: unpack (GHC.Base)
Rule fired: fold/build (GHC.Base)
Rule fired: Class op >> (BUILTIN)
-Rule fired: SPEC/T4007 sequence__c @IO _ _ (T4007)
+Rule fired: SPEC/T4007 sequence__c @IO @_ @_ (T4007)
Rule fired: <# (BUILTIN)
Rule fired: tagToEnum# (BUILTIN)
Rule fired: unpack-list (GHC.Base)
diff --git a/testsuite/tests/simplCore/should_compile/T15445.stderr b/testsuite/tests/simplCore/should_compile/T15445.stderr
index b67e385a98..d66a294f5d 100644
--- a/testsuite/tests/simplCore/should_compile/T15445.stderr
+++ b/testsuite/tests/simplCore/should_compile/T15445.stderr
@@ -1,11 +1,11 @@
Rule fired: Class op + (BUILTIN)
Rule fired: Class op fromInteger (BUILTIN)
Rule fired: Int# -> Integer -> Int# (GHC.Num.Integer)
-Rule fired: SPEC plusTwoRec (T15445a)
-Rule fired: SPEC $fShowList (GHC.Show)
+Rule fired: USPEC plusTwoRec @Int (T15445a)
+Rule fired: USPEC $fShowList @Int (GHC.Show)
Rule fired: Class op >> (BUILTIN)
Rule fired: Class op show (BUILTIN)
-Rule fired: SPEC plusTwoRec (T15445a)
+Rule fired: USPEC plusTwoRec @Int (T15445a)
Rule fired: Class op enumFromTo (BUILTIN)
Rule fired: Class op show (BUILTIN)
Rule fired: Class op enumFromTo (BUILTIN)
diff --git a/testsuite/tests/simplCore/should_compile/T19246.stderr b/testsuite/tests/simplCore/should_compile/T19246.stderr
index acfe1500b8..9e649711fa 100644
--- a/testsuite/tests/simplCore/should_compile/T19246.stderr
+++ b/testsuite/tests/simplCore/should_compile/T19246.stderr
@@ -4,8 +4,8 @@
==================== Tidy Core rules ====================
-"SPEC f" [2] forall ($dOrd :: Ord Int). f @Int $dOrd = $sf
"SPEC/T19246 $wf @Int" [2]
forall ($dOrd :: Ord Int). $wf @Int $dOrd = $s$wf
+"USPEC f @Int" [2] forall ($dOrd :: Ord Int). f @Int $dOrd = $sf
diff --git a/testsuite/tests/simplCore/should_compile/T8331.stderr b/testsuite/tests/simplCore/should_compile/T8331.stderr
index 0fbd7a577c..41bc7de5f4 100644
--- a/testsuite/tests/simplCore/should_compile/T8331.stderr
+++ b/testsuite/tests/simplCore/should_compile/T8331.stderr
@@ -1,6 +1,6 @@
==================== Tidy Core rules ====================
-"SPEC useAbstractMonad"
+"USPEC useAbstractMonad @(ReaderT Int (ST s))"
forall (@s)
($dMonadAbstractIOST :: MonadAbstractIOST (ReaderT Int (ST s))).
useAbstractMonad @(ReaderT Int (ST s)) $dMonadAbstractIOST
diff --git a/testsuite/tests/simplCore/should_compile/T8848.stdout b/testsuite/tests/simplCore/should_compile/T8848.stdout
index c4a33adb65..5cfdc6d3ff 100644
--- a/testsuite/tests/simplCore/should_compile/T8848.stdout
+++ b/testsuite/tests/simplCore/should_compile/T8848.stdout
@@ -1,2 +1,2 @@
-Rule fired: SPEC map2 (T8848)
-Rule fired: SPEC map2 (T8848)
+Rule fired: USPEC map2 @('S ('S 'Z)) @_ @_ @_ (T8848)
+Rule fired: USPEC map2 @('S ('S 'Z)) @_ @_ @_ (T8848)
diff --git a/testsuite/tests/simplCore/should_compile/T8848a.stderr b/testsuite/tests/simplCore/should_compile/T8848a.stderr
index 82d9815221..e5b069b1f9 100644
--- a/testsuite/tests/simplCore/should_compile/T8848a.stderr
+++ b/testsuite/tests/simplCore/should_compile/T8848a.stderr
@@ -1,6 +1,6 @@
==================== Tidy Core rules ====================
-"SPEC f"
+"USPEC f @[Int] @_"
forall (@b) ($dOrd :: Ord [Int]). f @[Int] @b $dOrd = f_$sf @b
diff --git a/testsuite/tests/simplCore/should_compile/spec004.stderr b/testsuite/tests/simplCore/should_compile/spec004.stderr
index 825319bcb6..c1265b3d54 100644
--- a/testsuite/tests/simplCore/should_compile/spec004.stderr
+++ b/testsuite/tests/simplCore/should_compile/spec004.stderr
@@ -1,9 +1,9 @@
==================== Specialise ====================
Result size of Specialise
- = {terms: 53, types: 46, coercions: 0, joins: 0/0}
+ = {terms: 52, types: 41, coercions: 0, joins: 0/0}
--- RHS size: {terms: 14, types: 12, coercions: 0, joins: 0/0}
+-- RHS size: {terms: 13, types: 10, coercions: 0, joins: 0/0}
$sfoo [InlPrag=NOINLINE[0]] :: Int -> [Char]
[LclId, Arity=1]
$sfoo
@@ -16,9 +16,9 @@ $sfoo
@b
c
(GHC.CString.unpackFoldrCString# @b "!"# c n)
- (show @Int GHC.Show.$fShowInt y))
+ (GHC.Show.$fShowInt_$cshow y))
--- RHS size: {terms: 17, types: 17, coercions: 0, joins: 0/0}
+-- RHS size: {terms: 17, types: 15, coercions: 0, joins: 0/0}
foo [InlPrag=NOINLINE[0]] :: forall a. () -> Show a => a -> String
[LclIdX,
Arity=3,
@@ -49,7 +49,7 @@ $trModule = "main"#
$trModule :: GHC.Types.TrName
[LclId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
$trModule = GHC.Types.TrNameS $trModule
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
@@ -63,15 +63,15 @@ $trModule = "ShouldCompile"#
$trModule :: GHC.Types.TrName
[LclId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
$trModule = GHC.Types.TrNameS $trModule
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
-ShouldCompile.$trModule :: GHC.Unit.Module
+ShouldCompile.$trModule :: GHC.Types.Module
[LclIdX,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}]
-ShouldCompile.$trModule = GHC.Unit.Module $trModule $trModule
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
+ShouldCompile.$trModule = GHC.Types.Module $trModule $trModule
-- RHS size: {terms: 5, types: 1, coercions: 0, joins: 0/0}
bar :: String