summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-02-26 13:43:48 -0500
committerBen Gamari <ben@smart-cactus.org>2017-02-26 14:56:03 -0500
commit517ad201ff6ca1ef0d78c22f31de747709fb7c99 (patch)
treef2cd92681275cc4a31359d119e2904936ec0df85
parentd4b6deee0edb1ef37d638aacc42c638b54bd9726 (diff)
downloadhaskell-517ad201ff6ca1ef0d78c22f31de747709fb7c99.tar.gz
Add testcase for #13340
Test Plan: Validate Reviewers: rwbarton, austin Reviewed By: rwbarton Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3215
-rw-r--r--testsuite/tests/simplCore/should_compile/Makefile6
-rw-r--r--testsuite/tests/simplCore/should_compile/T13340.hs6
-rw-r--r--testsuite/tests/simplCore/should_compile/T13340.stdout1
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T1
4 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile
index 7dd784bf45..1206ad6f6a 100644
--- a/testsuite/tests/simplCore/should_compile/Makefile
+++ b/testsuite/tests/simplCore/should_compile/Makefile
@@ -195,3 +195,9 @@ T13025:
str-rules:
$(RM) -f str-rules.hi str-rules.o
'$(TEST_HC)' $(TEST_HC_OPTS) -c -O str-rules.hs -ddump-simpl | grep -o '"@@@[^"].*"#' | sort
+
+# We expect there to be precisely one use of +# in the simplified Core as f and
+# g should have been collapsed into one defininition by CSE.
+.PHONY: T13340
+T13340:
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c -O T13340.hs -ddump-simpl -dsuppress-all | grep '\+#' | wc -l
diff --git a/testsuite/tests/simplCore/should_compile/T13340.hs b/testsuite/tests/simplCore/should_compile/T13340.hs
new file mode 100644
index 0000000000..813855ba97
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T13340.hs
@@ -0,0 +1,6 @@
+module Hi where
+
+-- These two should be de-duplicated by CSE
+f, g :: Int -> Int
+f x = 2 + x
+g x = 2 + x
diff --git a/testsuite/tests/simplCore/should_compile/T13340.stdout b/testsuite/tests/simplCore/should_compile/T13340.stdout
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T13340.stdout
@@ -0,0 +1 @@
+1
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 53f5ade353..5227c1139d 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -244,3 +244,4 @@ test('T13317',
normal,
run_command,
['$MAKE -s --no-print-directory T13317'])
+test('T13340', expect_broken(13340), run_command, ['$MAKE -s --no-print-directory T13340'])