summaryrefslogtreecommitdiff
path: root/testsuite/tests/simplCore
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2019-10-29 09:19:14 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-11-01 23:11:37 -0400
commit4a6d3d68f2ce97c1f231eede3819299a0fd2b9c8 (patch)
treef5f90d0965ee9dbe4f8ea5bb07fbbb4a8ec41a64 /testsuite/tests/simplCore
parentcabafe34156acb80cd9a918363b2a342fb0c8e66 (diff)
downloadhaskell-4a6d3d68f2ce97c1f231eede3819299a0fd2b9c8.tar.gz
Make CSE delay inlining less
CSE delays inlining a little bit, to avoid losing vital specialisations; see Note [Delay inlining after CSE] in CSE. But it was being over-enthusiastic. This patch makes the delay only apply to Ids with specialisation rules, which avoids unnecessary delay (#17409).
Diffstat (limited to 'testsuite/tests/simplCore')
-rw-r--r--testsuite/tests/simplCore/should_compile/Makefile5
-rw-r--r--testsuite/tests/simplCore/should_compile/T17409.hs9
-rw-r--r--testsuite/tests/simplCore/should_compile/T17409.stdout2
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T5
4 files changed, 20 insertions, 1 deletions
diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile
index c27458c46c..1daf834381 100644
--- a/testsuite/tests/simplCore/should_compile/Makefile
+++ b/testsuite/tests/simplCore/should_compile/Makefile
@@ -2,6 +2,11 @@ TOP=../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
+T17409:
+ $(RM) -f T17409.o T17409.hi
+ - '$(TEST_HC)' $(TEST_HC_OPTS) -O -c -dverbose-core2core -dsuppress-uniques T17409.hs 2> /dev/null | grep '\<id\>'
+ # Expecting 'id' to be inlined in the 'gentle' pass
+
T14978:
$(RM) -f T14978.o T14978.hi
-'$(TEST_HC)' $(TEST_HC_OPTS) -O -c -ddump-simpl T14978.hs -dsuppress-coercions | grep 'foo'
diff --git a/testsuite/tests/simplCore/should_compile/T17409.hs b/testsuite/tests/simplCore/should_compile/T17409.hs
new file mode 100644
index 0000000000..512f152cf1
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T17409.hs
@@ -0,0 +1,9 @@
+module T17409 where
+
+-- The bug was that id was inlined only after the
+-- "gentle" simplifier pass, beucause CSE in GHC.Base
+-- had commoned-up 'id' with 'breakpoint', and added
+-- a NOINLINE[2] to the former.
+
+-- The test just checks that id is inlined early.
+f x = not (id x)
diff --git a/testsuite/tests/simplCore/should_compile/T17409.stdout b/testsuite/tests/simplCore/should_compile/T17409.stdout
new file mode 100644
index 0000000000..50edd27281
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T17409.stdout
@@ -0,0 +1,2 @@
+ f = \ (x :: Bool) -> not (id @ Bool x); } in
+f = \ (x :: Bool) -> not (id @ Bool x)
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 35933e8be4..838ae93cad 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -311,4 +311,7 @@ test('T16979b', normal, compile, ['-O'])
test('T17140',
[extra_files(['T17140a.hs'])],
makefile_test,
- ['T17140']) \ No newline at end of file
+ ['T17140'])
+test('T17409',
+ normal,
+ makefile_test, ['T17409'])